[LLVMbugs] [Bug 14933] New: please make format string checking work with constexpr functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 11 22:33:32 PST 2013


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

             Bug #: 14933
           Summary: please make format string checking work with constexpr
                    functions
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: b.r.longbons at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


// One simple testcase that gcc 4.6 and 4.7 pass, but clang 3.2 fails:

// compile with -std=c++0x -Wformat=2
#include <cstdio>

constexpr const char *get_format() { return "Hello, %s"; }
constexpr const char *format = get_format();

int main() {
    // expected warning: "expected char *, got int"
    // actual warning: "format not a string literal"
    printf(format, 3);
}

// For more testcases, see:
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50593

-- 
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