]> granicus.if.org Git - clang/commit
[AST] String literal operator templates have two template args, not one
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 5 Apr 2015 05:32:54 +0000 (05:32 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 5 Apr 2015 05:32:54 +0000 (05:32 +0000)
commitfa50c3fd4e5c36ed6322a2b4d56683306ab478c3
treeb5f3f5c54bbd9f2d4d11740debe48c5405dc4075
parent6a66b0f4ad8d0667ba3e3ee0e1d26e2015677ba5
[AST] String literal operator templates have two template args, not one

StmtPrinter assumed that the first template arg was the pack and
attempted to iterate it.  However, the GNU extension (which is really
just N3599), has two template arguments.  In this case, the second
argument is the pack containing the string contents.

Handle this by desugaring the call to the explicit operator.

For example:
"qux" _zombocom will be shown as
operator "" _zombocom<char, 'q', 'u', 'x'>() in diagnostics and AST
dumps.

N.B.  It is actually impossible to render the arguments back to the
source form without storing more information in the AST.  For example,
we cannot tell if the user wrote u8"qux" or "qux".  We also lose
fidelity when it comes to non-char types for this exact reason (e.g. it
is hard to render a list of wchar_t back to something that can be
printed to the screen even if you don't have to consider surrogate
pairs).

This fixes PR23120.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234110 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/StmtPrinter.cpp
test/SemaCXX/cxx11-ast-print.cpp