This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/54368] New: [c++0x] Internal error when passing an identifier in static_assert instead of string-literal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54368

             Bug #: 54368
           Summary: [c++0x] Internal error when passing an identifier in
                    static_assert instead of string-literal
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: im.razzy@gmail.com


Created attachment 28078
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28078
Automatic created attachment: /tmp/ccWAFQ2I.out

This simple code causes an internal error:

    char *string = "1";

    int main() {
        static_assert(0, string);
    }

This is the result of my compiling attempt:

$ g++ --std=c++11 bug.cc                                                        
bug.cc: In function 'int main()':                                               
bug.cc:4:22: error: expected string-literal before 'string'                     
bug.cc:4:22: error: expected ')' before 'string'                                
bug.cc:4:5: internal compiler error: tree check: expected string_cst, have
error_mark in finish_static_assert, at cp/semantics.c:5135                      
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cc3YRBkR.out file, please attach this to
your bugreport.
razinov@razinov-desktop ~/tmp $ 

As you can find, EVERY type of the variable "string" causes the same error.

Environment: gcc version 4.8.0 20120314 (experimental) [trunk revision 185382]
(Ubuntu/Linaro 20120314-0ubuntu2)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]