Gcc bug or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Have a look at this simple code:

template <typename OBJECT>
struct Foo {
static void fn() {foo(OBJECT());}
};
struct Bar {};
void foo(int);
// void foo(Bar);
void x() {
Foo<int>::fn();
// Foo<Bar>::fn();
}

With gcc 4.7-5.0, this code doesn't compile with the error "‘foo’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation"

But, if you remove "void foo(int)", and the call of "Foo<int>::fn()", and activate the two commented lines, this code compiles.

I don't understand what difference it makes whether I use "int" or "Bar" as a parameter.

Interestingly, clang 3.5 behaves the same ("int" version doesn't compile, but "Bar" version does). gcc 4.6 or older compiles this code.

Is it a bug?

Thanks,
Geza




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux