[Bug c++/63414] template parse error using < operator

tomalk at mathematik dot uni-freiburg.de gcc-bugzilla@gcc.gnu.org
Tue Sep 30 11:45:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63414

--- Comment #1 from Tobias Malkmus <tomalk at mathematik dot uni-freiburg.de> ---
#include <iostream>

template<class T>
int bar ( const T& ) { return 0; }

struct Foo
{
  int bar;
};

template<class F>
void callBar ( F& foo )
{
  if( foo.bar<0 )
    std::cout<<foo.bar<<std::endl;
}

int main ()
{
  Foo foo;
  foo.bar = -1;
  callBar( foo );
  return 0;
}

should be a correct code, but gcc complains with the error:

In function ‘void callBar(F&)’:
error: parse error in template argument list

I got this error for the gcc version 3.4.1, 4.1.2, 4.2.4, 4.3.6, 4.4.7, 4.5.4,
4.6.4, 4.7.4, 4.8.3 and 4.9.1.

The same hold for icc in different version, but not for clang 3.5.0.


More information about the Gcc-bugs mailing list