T
Timon Gehr
g++ fails to compile the following code snippet:
---
struct B{int foo;};
template<class T> int foo(T x){
int y = x.foo<1>(0);
return y;
}
int main(){
int c = foo(B());
}
---
---
bug.cpp: In function ‘int foo(T) [with T = B]’:
bug.cpp:10:17: instantiated from here
bug.cpp:5:20: error: ‘foo’ is not a member template function
---
The code compiles if the template function is renamed from 'foo' to
'bar'.
Is this a bug?
---
struct B{int foo;};
template<class T> int foo(T x){
int y = x.foo<1>(0);
return y;
}
int main(){
int c = foo(B());
}
---
---
bug.cpp: In function ‘int foo(T) [with T = B]’:
bug.cpp:10:17: instantiated from here
bug.cpp:5:20: error: ‘foo’ is not a member template function
---
The code compiles if the template function is renamed from 'foo' to
'bar'.
Is this a bug?