[Bug c++/55408] New: ICE for member template definition with non-type variadic parameter

lucdanton at free dot fr gcc-bugzilla@gcc.gnu.org
Tue Nov 20 07:18:00 GMT 2012


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

             Bug #: 55408
           Summary: ICE for member template definition with non-type
                    variadic parameter
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lucdanton@free.fr


Created attachment 28740
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28740
Reproducible testcase

$ g++-snapshot --version
g++-snapshot (Debian 20120915-1) 4.8.0 20120915 (experimental) [trunk revision
191353]

When attempting to compile this program:

struct foo {
    template<int*>
    void bar();
};

template<int*...>
void foo::bar() {}

int main()
{
    extern int i;
    foo {}.bar<&i>();
}

GCC complains:

main.cpp: In function 'int main()':
main.cpp:12:21: internal compiler error: Segmentation fault
     foo {}.bar<&i>();
                     ^

Some casual investigating suggests that this happens every time the definition
for a member template is exactly the same as its declaration save for the fact
that a non-type parameter is made variadic. Otherwise, e.g. if the parameter in
question is a type or template parameter in the declaration or if the template
is declared taking int and defined taking long... then GCC correctly reports
that the definition doesn't have a match.



More information about the Gcc-bugs mailing list