[Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)

slayoo at staszic dot waw.pl gcc-bugzilla@gcc.gnu.org
Tue Apr 23 08:21:00 GMT 2013


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

             Bug #: 57041
           Summary: ICE in lookup_field_1, at cp/search.c:376 (with
                    dot-prefixed structure initialisation)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: slayoo@staszic.waw.pl


Hi,


$ cat bug.cpp 
#include <map>
#include <string>

template <class T>
void setopts(T &p)
{
  p.outvars = {{0, {.name = "psi", .unit = "1"}}};
}

int main()
{        
  struct 
  {
    struct info { std::string name, unit; };
    std::map<int, info> outvars;
  } p;
  setopts(p);
}



$ /usr/lib/gcc-snapshot/bin/g++ -std=c++11 bug.cpp 
bug.cpp: In instantiation of 'void setopts(T&) [with T = main()::<anonymous
struct>]':
bug.cpp:17:12:   required from here
bug.cpp:7:13: error: 'name' was not declared in this scope
   p.outvars = {{0, {.name = "psi", .unit = "1"}}};
             ^
bug.cpp:7:13: error: 'unit' was not declared in this scope
bug.cpp:7:13: internal compiler error: in lookup_field_1, at cp/search.c:376
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/ccLInnuE.out file, please attach this to
your bugreport.



$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20130209-1) 4.8.0 20130209 


Clang compiles it with no warnings or errors.

HTH,
Sylwester



More information about the Gcc-bugs mailing list