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++/64514] [4.9/5 Regression] Error in template instantiation in GCC 4.9, works fine in GCC 4.8


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

--- Comment #1 from Freddie Chopin <freddie_chopin at op dot pl> ---
The question at stackoverflow has an answer with much simpler test-case which
also shows the problem. http://stackoverflow.com/a/27810002/157344

--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---

template<typename... T>
struct Functor
{
    template <T...>
    struct Inner
    {};
};

template struct Functor<>::Inner<>;

int main()
{

}

--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---

Compiled with GCC 4.9.2:

--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---

$ g++ -std=c++11 test.cpp 
test.cpp: In instantiation of âstruct Functor<>â:
test.cpp:9:26:   required from here
test.cpp:5:12: error: wrong number of template arguments (1, should be 0)
     struct Inner
            ^
test.cpp:5:12: error: provided for âtemplate<class ... T> template<T
...<anonymous> > struct Functor<T>::Innerâ
test.cpp:5:12: error: wrong number of template arguments (1, should be 0)
test.cpp:5:12: error: provided for âtemplate<class ... T> template<T
...<anonymous> > struct Functor<T>::Innerâ
test.cpp:9:28: error: âInnerâ is not a class template
 template struct Functor<>::Inner<>;
                            ^
test.cpp:9:28: error: âInnerâ in âstruct Functor<>â does not name a type

--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---

Works fine with GCC 4.8.

The answer also suggests there might be another similar bug, possibly related
to the first one.

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