public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28093]  New: Wrong overload resolution with templates and namespaces
@ 2006-06-20 10:27 joerg dot richter at pdv-fs dot de
  2006-06-20 16:35 ` [Bug c++/28093] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: joerg dot richter at pdv-fs dot de @ 2006-06-20 10:27 UTC (permalink / raw)
  To: gcc-bugs

$ cat t.cc
#include <cstdio>
using namespace std;

namespace ident {
template<class T> void
foo( T*, void* )
{
  printf( "generic\n" );
}
}
using namespace ident;

template<class T> void func( T& val )
{
  foo( &val, (T*)0 );
}

struct Base
{};

struct Deriv : public Base
{};

namespace ident {

template<class T> void
foo( T* val, Base* )
{
  printf( "special\n" );
}

}

int main()
{
  Deriv d;
  func( d );
}


$ g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /tools/inst/jrichter/tmp.evo1.18630/gcc-4.1.1/configure
--prefix=/tools/pkg/gcc/4.1.1 --enable-languages=c,c++ --disable-threads
Thread model: single
gcc version 4.1.1

$ g++ -o t t.cc
$ t
generic

While GCC 3.4.3 outputs "special"


-- 
           Summary: Wrong overload resolution with templates and namespaces
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/28093] Wrong overload resolution with templates and namespaces
  2006-06-20 10:27 [Bug c++/28093] New: Wrong overload resolution with templates and namespaces joerg dot richter at pdv-fs dot de
@ 2006-06-20 16:35 ` pinskia at gcc dot gnu dot org
  2009-08-23  2:20 ` bdavis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-20 16:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-06-20 15:57 -------
No, this is invalid, as both Base and Deriv are in the global namespace so the
ident namespace is not looked at again after the parsing of the template.  If
either of them were in the ident namespace, GCC will look back  into the ident
namespace for argument dependent lookup.
So what is happening here is that an overloaded set for foo is being generated
when func is parsed and then it is instainated, a secondary overloaded set is
generated for argument dependent lookup which is only within the namespace
where the type is defined.

3.4 was incorrect in calling generic and did not conform to the standard at
all.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/28093] Wrong overload resolution with templates and namespaces
  2006-06-20 10:27 [Bug c++/28093] New: Wrong overload resolution with templates and namespaces joerg dot richter at pdv-fs dot de
  2006-06-20 16:35 ` [Bug c++/28093] " pinskia at gcc dot gnu dot org
@ 2009-08-23  2:20 ` bdavis at gcc dot gnu dot org
  2009-08-26  2:18 ` bdavis at gcc dot gnu dot org
  2009-08-27 12:06 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2009-08-23  2:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bdavis at gcc dot gnu dot org  2009-08-23 02:20 -------
Subject: Bug 28093

Author: bdavis
Date: Sun Aug 23 02:19:59 2009
New Revision: 151021

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151021
Log:
2009-08-22      Bud Davis <bdavis9659@sbcglobal.net>

        PR fortran/28093
        * io.c : added variable to store original len of fmt
        * io.c (check_format): Consume H items using next_char
        in both modes to handle consecutive single quotes.
        Test for extra characters in fmt, issue warning.

2009-08-22  Bud Davis  <bdavis9659@sbcglobal.net>

        PR fortran/28039
        * gfortran.dg/fmt_with_extra.f: new file.



Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_with_extra.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/28093] Wrong overload resolution with templates and namespaces
  2006-06-20 10:27 [Bug c++/28093] New: Wrong overload resolution with templates and namespaces joerg dot richter at pdv-fs dot de
  2006-06-20 16:35 ` [Bug c++/28093] " pinskia at gcc dot gnu dot org
  2009-08-23  2:20 ` bdavis at gcc dot gnu dot org
@ 2009-08-26  2:18 ` bdavis at gcc dot gnu dot org
  2009-08-27 12:06 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2009-08-26  2:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bdavis at gcc dot gnu dot org  2009-08-26 02:18 -------
Subject: Bug 28093

Author: bdavis
Date: Wed Aug 26 02:18:14 2009
New Revision: 151112

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151112
Log:
2009-08-22      Bud Davis <bdavis9659@sbcglobal.net>

         PR fortran/28093
         * io.c: reverted previous patch



Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/28093] Wrong overload resolution with templates and namespaces
  2006-06-20 10:27 [Bug c++/28093] New: Wrong overload resolution with templates and namespaces joerg dot richter at pdv-fs dot de
                   ` (2 preceding siblings ...)
  2009-08-26  2:18 ` bdavis at gcc dot gnu dot org
@ 2009-08-27 12:06 ` burnus at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-27 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2009-08-27 12:05 -------
For completeness, the committal was for PR fortran/28039


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-27 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-20 10:27 [Bug c++/28093] New: Wrong overload resolution with templates and namespaces joerg dot richter at pdv-fs dot de
2006-06-20 16:35 ` [Bug c++/28093] " pinskia at gcc dot gnu dot org
2009-08-23  2:20 ` bdavis at gcc dot gnu dot org
2009-08-26  2:18 ` bdavis at gcc dot gnu dot org
2009-08-27 12:06 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).