Ray's Knowledge Base
Unlock

?? followed by ', (, ) and others in a C++ string is a trigraph

PitfallVerified 27 Sep 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

An error message such as "arithmetic or '??' (duql stage 12a2)" draws a clang warning:

Trigraph ignored [-Wtrigraphs]

Cause#

??', ??(, ??), ??=, ??/, ??!, ??<, ??> and ??- are trigraphs. C++17 removed them, so clang ignores them but warns; an older standard mode or another compiler may replace them.

Fix#

Do not write ?? directly before one of those characters in a literal. Reword ("a coalesce"), or split the literal: "'?" "?'". "??" followed by " or a letter is not a trigraph.

Evidence#

  • dftracer-utils duql lowering (2026-09-27): clangd reported the warning on src/dftracer/utils/duql/lower.cpp; after the rewording the full tests build had no warnings.

Also found by searching

  • clang: warning: trigraph ignored [-Wtrigraphs] on "arithmetic or '??'" string literal
  • clangd warns about a string literal in my C++ error message that contains two question marks
  • how do I write ?? followed by a quote or parenthesis in a C++ string literal without a warning?
  • C++ ??' ??( ??= sequence in string literal replaced or warned, trigraphs in older standard mode
  • warning: Trigraph ignored [-Wtrigraphs] in C++ string literal with '??'
  • clang warns about ?? followed by apostrophe in my error message string
  • how do I write a literal with question marks in C++ without trigraph warning?
  • gcc -Wtrigraphs "??(" "??'" in string constant replaced in older standard