[LLVMbugs] [Bug 10288] New: Clang rejects string literal initializer for char array that has no explicit size

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 6 11:41:25 PDT 2011


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

           Summary: Clang rejects string literal initializer for char
                    array that has no explicit size
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang rejects "#1" and accepts "#2"

    char x[]("hello"); // #1
    char x[6]("hello"); // #2

The example in clause 8.5.2 makes it clear that deducing the size of the
initialized array is not dependent on enclosing braces, showing this example

    char x[] = "hello"; // no braces around the initializer

This is accepted by clang. The existence of parentheses (not braces) around the
initializer expression should not make a difference for non-class types, see
8.5p11.

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