[LLVMbugs] [Bug 13099] New: raw string literals as format strings leads to a -Wformat crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 12 21:13:40 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13099

             Bug #: 13099
           Summary: raw string literals as format strings leads to a
                    -Wformat crash
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


void f() {
  __builtin_printf(
    R"abcd(%.)abcd"
     "*d");
}

clang-3.2: lib/Lex/LiteralSupport.cpp:1380: unsigned int
clang::StringLiteralParser::getOffsetOfStringByte(const clang::Token &,
unsigned int) const: Assertion `SpellingPtr[0] == '"' && "Should be a string
literal!"' failed.


Also:

void g() {
  __builtin_printf(
    u8R"abcd(%.)abcd"
       "*d");
}

<stdin>:3:5: warning: format string should not be a wide string [-Wformat]
    u8R"abcd(%.)abcd"
    ^~~~~~~~~~~~~~~~~

This diagnostic is wrong; a UTF-8 format string seems completely reasonable.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list