From a diagnostics point-of-view, neither version is quoted:
c/c-parser.c: error_at (assert_loc, "static assertion failed: %E", string);
cp/semantics.c: error ("static assertion failed: %s",
To be "quoted", it would need to use either %q or %<%>. Note that %qs
would produce `foo' not "foo". Nevertheless, we probably want to print
'x' for character literals and not `'x'' and "string" for string
literals and not `string'. Thus, the wiki should probably be amended to
clarify this.
Also, there is a substantial difference between %E and %s when the
string contains control characters such as \n \t \u etc. Clang uses
something similar to %E.
I agree that the two sets of quotes in '"string"' don't look quite
right, and that letting embedded control sequences affect the compiler
output probably isn't a good idea. Which, AFAICT, leaves a plain %E
as the only option.
The nice thing about %qE (or %<%E%>) vs plain %E is that the former
highlight the text of the string (i.e., make it bold). That makes
the reason for the error stand out. It would be nice if there were
a way to do that without adding the extra pair of quotes or giving
up on the control character transformation.
For comparison, we use %s to print
test.c:1:9: note: #pragma message:
string
#pragma message "\nstring"
That seems potentially unsafe and might be worth changing to match
the static_assert.
Martin