Re: please review: possible C++ template bug?

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

 



Hi,
On Mon, Oct 18, 2010 at 06:41:35AM +0900, Miles Bader wrote:
> Shawn Yarbrough <shawn.yarbrough@xxxxxxxxx> writes:
> > Code sample below. I believe this is a gcc compiler bug because line
> > 16 gives an error "has not been declared"
> I note that Clang gives a similar error on this code...
I think one needs a real language lawyer here: As I understand the
standard (from 2003), I think:
Yes, it is a "dependent name" (as it depends on the template parameter
TT).
However, the standard says that for dependent name resolution are used
§14.6.4):
1) declarations visible during definition of the template
2) For declarations from "namespaces associated with the types of the
function arguments" also the ones visible during the instantiation of
the template.

But is the function "::bar(tt)" now from such a namespace?  

You can reproduce the same (or at least a similar) problem with a much
shorter program:

namespace X {
  template<typename A> void foo(A a){  ::bar(a);  }
}
void bar(int x){ }
int main(){  X::foo(1);  }

This gives the same error, except if "bar" is already declared before the
template definition.

Axel


[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