public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early
@ 2003-08-06  9:18 benko at sztaki dot hu
  2004-10-28 13:53 ` [Bug c++/11828] [3.4/4.0 " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: benko at sztaki dot hu @ 2003-08-06  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           Summary: [3.4 regression] qualified dependent name looked up too
                    early
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: benko at sztaki dot hu
                CC: gcc-bugs at gcc dot gnu dot org

hydra:~/c/proba$ cat templ_overload.cc
namespace n
{
  template <typename T>
  void
  f(T a)
  {
    a.f();
  }

  template <typename T>
  void
  g(T a)
  {
    n::f(a);
  }
}

struct s
{};

namespace n
{
  void
  f(s)
  {}
}

int
main()
{
  n::g(s());

  return 0;
}
hydra:~/c/proba$ g++-cvs templ_overload.cc
templ_overload.cc: In function `void n::f(T) [with T = s]':
templ_overload.cc:14:   instantiated from `void n::g(T) [with T = s]'
templ_overload.cc:31:   instantiated from here
templ_overload.cc:7: error: 'struct s' has no member named 'f'
zsh: exit 1     g++-cvs templ_overload.cc
hydra:~/c/proba$ g++-cvs -v
Reading specs from /gml/shared/gcc-cvs/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/gml/shared/gcc-cvs
--enable-languages=c++
Thread model: posix
gcc version 3.4 20030806 (experimental)
hydra:~/c/proba$ g++3 templ_overload.cc
hydra:~/c/proba$ g++3 -v
Reading specs from /gml/shared/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/gml/shared/gcc-3.3
Thread model: posix
gcc version 3.3
hydra:~/c/proba$ 

workarounds:
1. unqualify f in the definition of g.
   I cannot do this, because in real life n=std, f=iter_swap, g=reverse.
2. Move the definition of the overload for f before the definition of g.


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

end of thread, other threads:[~2006-02-08 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11828-2595@http.gcc.gnu.org/bugzilla/>
2006-02-07  2:24 ` [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early pinskia at gcc dot gnu dot org
2006-02-08 17:44 ` pinskia at gcc dot gnu dot org
2003-08-06  9:18 [Bug c++/11828] New: [3.4 " benko at sztaki dot hu
2004-10-28 13:53 ` [Bug c++/11828] [3.4/4.0 " pinskia at gcc dot gnu dot org
2005-02-21 19:12 ` smcpeak at cs dot berkeley dot edu
2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
2005-03-04  5:00 ` smcpeak at cs dot berkeley dot edu

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).