http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55576
Bug #: 55576
Summary: Fails to compile a call to template member function
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 28860
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28860
Output of `gcc -v -save-temps -Wall -Wextra main.cpp`
When compiling following code:
struct factory {
template <typename T>
void * apply(void * address)
{
return new (address) T;
}
};
template <typename T>
struct apply {
template <typename FactoryT>
void* operator()(FactoryT const& f, void * address) {
return f.template apply<T>(address);
}
};
int main() {
int place;
apply<int>()(factory(), &place);
return 0;
}
Tries to instantiate structure `apply` instead of calling a `factory` member
function `apply` (prints error: invalid use of ‘struct apply<T>’).