[Bug c++/52350] Parse error calling a template method in a template class

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 23 10:32:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52350

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-23 10:28:48 UTC ---
Not a bug, all conforming compilers will reject this code (e.g. try it at
http://www.comeaucomputing.com/tryitout/ or http://llvm.org/demo to check)

You need to say:

        return factory.template constructT<T>();

because factory is a dependent name and the compiler doesn't know that
factory.constructT is a template (it could be a data member being compared with
less-than)

See http://womble.decadent.org.uk/c++/template-faq.html#disambiguation



More information about the Gcc-bugs mailing list