This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52350] New: Parse error calling a template method in a template class
- From: "joseph at mirriad dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 23 Feb 2012 10:09:03 +0000
- Subject: [Bug c++/52350] New: Parse error calling a template method in a template class
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52350
Bug #: 52350
Summary: Parse error calling a template method in a template
class
Classification: Unclassified
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: joseph@mirriad.com
The following code is self explanatory. Fails to compile as is, but succeeds if
you replace #if 1 with #if 0.
template<typename FP>
class Factory
{
public:
template<typename T>
T constructT() { return T(); }
};
template<typename T, typename FP>
class FactoryClient
{
public:
T construct() {
#if 1
Factory<FP> factory; // fails
#else
Factory<int> factory; // works
#endif
return factory.constructT<T>();
}
};
int main()
{
}