https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67621
Bug ID: 67621 Summary: Syntax error for template function of template class Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: physik3 at gmx dot net Target Milestone: --- Hey guys, I think I have found a bug in the GCC C++ frontend. I have a template class which provides a function with additional template parameters. This works fine if the class is parameterized with a non-template type or a template type whose arguments are fixed, but the compiler throws a syntax error if the class is parameterized with a template class itself whose argument is open. I could downsize the problem to the following minimal example: ============ template<typename F> struct Foo { template<typename T> void foo(void) {} }; template<typename B> struct Bar { }; int main(void) { Foo<double> foo1; foo1.foo<int>(); // this line works Foo<Bar<double>> foo2; foo2.foo<int>(); // this line works return 0; } template<typename B> void baz(void) { Foo<Bar<B>> foo; foo.foo<int>(); // this line gives a compiler error } ============ GCC quits with "error: expected β;β before βintβ". Because I cannot see any syntactical error, I guess it is a bug in GCC. Moreover, the Visual Studio compiler accepts this code. I detected this working with version 4.8.3, but I verified that it also affects the newer 5.2.1 release. Best