https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61541

            Bug ID: 61541
           Summary: Unexpected error: 'identifier' was not declared in
                    this scope, or ICE in gimplify.c:7871
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roman at binarylife dot net

$ cat test1.cc 
struct foo {
  template <int size>
  struct bar {
    char* p = new char[size];
  };
};

foo::bar<10> moo;

$ g++ -std=c++11 -c test1.cc
test1.cc:4:24: error: ‘size’ was not declared in this scope
     char* p = new char[size];
                        ^

$ cat test2.cc 
struct zoo {
  zoo(char*);
};

struct foo {
  template <int size>
  struct bar {
    static constexpr int s = size;
    zoo p = zoo(new char[s]);
  };
};

foo::bar<10> moo;

$ g++ -std=c++11 -c test2.cc |& head -4
test2.cc: In constructor ‘constexpr foo::bar<10>::bar()’:
test2.cc:9:27: internal compiler error: in gimplify_expr, at gimplify.c:7871
     zoo p = zoo(new char[s]);
                           ^

$ g++ --version | head -1
g++ (GCC) 4.8.4 20140617 (prerelease)

GCC 4.9 and later don't show these errors.

Reply via email to