Bug 63414 - template parse error using < operator
Summary: template parse error using < operator
Status: RESOLVED DUPLICATE of bug 10200
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2014-09-30 11:38 UTC by Tobias Malkmus
Modified: 2014-09-30 12:22 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-09-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Malkmus 2014-09-30 11:38:35 UTC

    
Comment 1 Tobias Malkmus 2014-09-30 11:45:24 UTC
#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.
Comment 2 Jonathan Wakely 2014-09-30 12:19:05 UTC
EDG accepts it too.
Comment 3 Andrew Pinski 2014-09-30 12:22:17 UTC
Dup of bug 10200.

*** This bug has been marked as a duplicate of bug 10200 ***