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

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35383

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Andrew Pinski  ---
I think GCC trunk does the correct for the first testcase.
ADL only finds functions in the same namespace as the arguments types; that is
why:
// move this line inside namespace Foo, and all is OK

Works.

as for func, GCC 4.7+ gets it correct and rejects the code for Fred.

So all invalid/fixed.

(In reply to ophir.setter+gcc from comment #2)
> Is the following the same bug as this bug?

It is the same accepts-invalid bug that is similar to func2 in the original
testcase.

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

2011-07-12 Thread ophir.setter+gcc at emc dot com
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 
  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


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

2008-02-26 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2008-02-26 18:59 ---
>func(hold.item);  // OK for Wilma, but fails for Foo::Fred, see below

This is correct.

>   func2(hold.item); // OK, not overloaded name

This is not and we still have a bug with respect of not having any overloaded
function before.
This should fail the same way func fails.


-- 


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