[Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 5 18:21:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11808


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
            Summary|[3.4 Regression] Wrong      |[3.4 regression] Wrong
                   |namespace lookup for        |namespace lookup for
                   |template function when      |template function when
                   |induced by a template       |induced by a template
                   |parameter                   |parameter


------- Additional Comments From bangerth at dealii dot org  2003-08-05 18:21 -------
Confirmed. Here's a cleaned-up example:
--------------------------
namespace NS_1 {
  struct A {};
  struct foo {};
}

namespace NS_2 {
  template <typename T> void foo(T);

  template <typename T>
  void bar() {
    NS_1::A a;
    NS_2::foo(a);
  }

  template void bar<int>();
}
---------------------------

g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void NS_2::bar() [with T = int]':
x.cc:15:   instantiated from here
x.cc:3: error: `struct NS_1::foo' is not a function,
x.cc:7: error:   conflict with `template<class T> void NS_2::foo(T)'
x.cc:12: error:   in call to `foo'

gcc seems to think it needs to do Koenig lookup, but this is unnecessary
here since the call to foo is namespace-qualified.

W.



More information about the Gcc-bugs mailing list