[Bug c++/35383] Lookup of template dependent function with overloads fails for namespace-qualified parameter

ophir.setter+gcc at emc dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 12 08:22:00 GMT 2011


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

ophir.setter+gcc at emc dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ophir.setter+gcc at emc dot
                   |                            |com

--- Comment #2 from ophir.setter+gcc at emc dot com 2011-07-12 08:21:25 UTC ---
Is the following the same bug as this bug?
If you remove the specified line it compiles, but without the line it doesn't.
According to my understanding of this analysis, the bug is that it compiles -
even without the line, the specified code should not compile. Am I right?

================================================
struct B {};

namespace N {
  void foo(){}  // If you comment this line, everything is well.

  template <class T>
  void bar(T& t) {
    foo(t);
  }

  void foo(::B&) {
  }
}

int main() {
  B tmp;
  N::bar(tmp);

  return 0;
}

================================================
gcc -v -save-temps main.cpp   -o main
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'main' '-mtune=generic'
'-march=i686'
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -E -quiet -v
-D_GNU_SOURCE main.cpp -D_FORTIFY_SOURCE=2 -mtune=generic -march=i686
-fpch-preprocess -fstack-protector -o main.ii
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory
"/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.5
 /usr/include/c++/4.5/i686-linux-gnu
 /usr/include/c++/4.5/backward
 /usr/local/include
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'main' '-mtune=generic'
'-march=i686'
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -fpreprocessed
main.ii -quiet -dumpbase main.cpp -mtune=generic -march=i686 -auxbase main
-version -fstack-protector -o main.s
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
    compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
    compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0c5cb630517b5952f4898dfa56d7e8e5
main.cpp: In function ‘void N::bar(T&) [with T = B]’:
main.cpp:17:13:   instantiated from here
main.cpp:8:5: error: too many arguments to function ‘void N::foo()’
main.cpp:4:8: note: declared here



More information about the Gcc-bugs mailing list