Bug in template parsing?

Marcel Keller M.Keller@bristol.ac.uk
Tue Jun 14 21:27:00 GMT 2016


Hi,

Trying to compile the attached code with GCC 5.3.0 gives the error:

templ_bug.cpp: In function ‘void g()’:
templ_bug.cpp:15:12: error: expected primary-expression before ‘)’ token
    T().f<t>();
             ^
templ_bug.cpp: In instantiation of ‘void g() [with T = A; int t = 0]’:
templ_bug.cpp:19:10:   required from here
templ_bug.cpp:15:8: error: invalid operands of types ‘<unresolved 
overloaded function type>’ and ‘int’ to binary ‘operator<’
    T().f<t>();
         ^

However, if I uncomment the commented line, it works fine. I cannot 
understand why this should make a difference. Is there a mistake in the 
code or a bug in GCC?

Best regards,
Marcel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: templ_bug.cpp
Type: text/x-c++src
Size: 240 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20160614/5ba258ce/attachment.bin>


More information about the Gcc-help mailing list