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: unassig...@gcc.gnu.org

        ReportedBy: lucdan...@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.

Reply via email to