http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56629
Bug #: 56629 Summary: template struct confused with template member function of same name Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: tallji...@gmail.com Created attachment 29675 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29675 minimal example to reproduce Seems to be a parse error, when a template member function with the same name as a template struct is called in certain heavily-templated conditions (please just take a look at the attached minimal example). Templates do not have to be instantiated to generate the error. The error message I see is: member-func-confused-with-struct.cc: In member function ‘void A<F>::operator()(T*) const’: member-func-confused-with-struct.cc:8:13: error: invalid use of ‘struct apply<T>’ I can confirm the problem with this example on gcc 4.6.3; a user reported this a bug in a library I maintain (in a very non-minimal case) with 4.7.2, so I strongly suspect the issue is present there as well. That same user reported no problems with clang++.