public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22206] New: gcc overload resolution fails to follow "using" in some cases
@ 2005-06-27 23:00 kjd at duda dot org
  2005-06-27 23:07 ` [Bug c++/22206] " pinskia at gcc dot gnu dot org
  2005-06-28 13:58 ` bangerth at dealii dot org
  0 siblings, 2 replies; 3+ messages in thread
From: kjd at duda dot org @ 2005-06-27 23:00 UTC (permalink / raw)
  To: gcc-bugs

gcc-3.4.3 fails to accept this valid program:

namespace Fwk {
  int valueToStrep( char const * ) { return 100;}
}
using Fwk::valueToStrep;
namespace Foo {
  int valueToStrep( int ) { return 200; }
  int foo2() { return valueToStrep( "hello" ); }
}

If you comment out the second "valueToStrep" function (the one that returns
200), then the program compiles as expected.

If you add a "using Fwk::valueToStrep" to "namespace Foo", then the program
compiles as expected.

This may be related to bug 20724.

Thanks,
    -Ken

-- 
           Summary: gcc overload resolution fails to follow "using" in some
                    cases
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kjd at duda dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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


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

* [Bug c++/22206] gcc overload resolution fails to follow "using" in some cases
  2005-06-27 23:00 [Bug c++/22206] New: gcc overload resolution fails to follow "using" in some cases kjd at duda dot org
@ 2005-06-27 23:07 ` pinskia at gcc dot gnu dot org
  2005-06-28 13:58 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-27 23:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-27 23:07 -------
This is invalid code but I don't have the time to explain why except to say that when inside a 
namespace, you look into the inner most namespace first and if it does not find any then the outer for 
overloads.

-- 


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


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

* [Bug c++/22206] gcc overload resolution fails to follow "using" in some cases
  2005-06-27 23:00 [Bug c++/22206] New: gcc overload resolution fails to follow "using" in some cases kjd at duda dot org
  2005-06-27 23:07 ` [Bug c++/22206] " pinskia at gcc dot gnu dot org
@ 2005-06-28 13:58 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2005-06-28 13:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-06-28 13:57 -------
Andrew is correct: name lookup proceeds from the present scope outward and 
stops once it finds a matching name (note: name, not signature) or names. It 
then tries to match the signature of the names to the call. This fails here. 
There is no requirement that the compiler then resume looking for other names 
in scopes further out. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2005-06-28 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-27 23:00 [Bug c++/22206] New: gcc overload resolution fails to follow "using" in some cases kjd at duda dot org
2005-06-27 23:07 ` [Bug c++/22206] " pinskia at gcc dot gnu dot org
2005-06-28 13:58 ` bangerth at dealii 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).