[LLVMbugs] [Bug 12226] New: 'expected relocatable expression' with unsigned char array initialized from string literal

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 10 06:22:26 PST 2012


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

             Bug #: 12226
           Summary: 'expected relocatable expression' with unsigned char
                    array initialized from string literal
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: l.lunak at suse.cz
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Steps to reproduce:

$ echo 'static const unsigned char array[] = { "a" };' >a.cpp
$ clang++ -std=c++11 a.cpp
fatal error: error in backend: expected relocatable expression

$ clang++ --version
SUSE Linux clang version 3.1 (trunk 152441) (based on LLVM 3.1svn)
Target: x86_64-unknown-linux-gnu
Thread model: posix

The problem goes away if not compiling in C+11 mode or if the array is of plain
char type instead of unsigned char.

Even if the code is actually invalid (I can't tell), at least a proper error
message should be given.

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