public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
@ 2003-08-01 20:14 ` pinskia at physics dot uc dot edu
2004-04-28 2:06 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-01 20:14 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=5660
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-05-06 00:00:00 |2003-08-01 20:14:38
date| |
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-01 20:14 -------
On the mainline (20030801):
It still prints `In base::f()'.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
2003-08-01 20:14 ` [Bug c++/5660] dependant names involving templates & inheritance pinskia at physics dot uc dot edu
@ 2004-04-28 2:06 ` pinskia at gcc dot gnu dot org
2004-04-28 8:43 ` bangerth at dealii dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-28 2:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-28 01:40 -------
template<typename T> struct W : public T
{
void g( W& w )
{
f(w); // <-- this is dependent should it not wait until instantiation to figure out what
function it should call?
}
};
Maybe I am just misreading the standard but I think GCC is right here.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-02-23 13:33:47 |2004-04-28 01:40:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
2003-08-01 20:14 ` [Bug c++/5660] dependant names involving templates & inheritance pinskia at physics dot uc dot edu
2004-04-28 2:06 ` pinskia at gcc dot gnu dot org
@ 2004-04-28 8:43 ` bangerth at dealii dot org
2004-04-28 11:30 ` giovannibajo at libero dot it
` (9 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-04-28 8:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-04-28 06:51 -------
Interestingly enough, icc prints
g/x> icc x.cc
g/x> ./a.out
In base::f()
just like gcc, but _if I switch on the strict mode_, we get
g/x> icc -Xc -ansi x.cc
g/x> ./a.out
In ::f()
That confuses even me...
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (2 preceding siblings ...)
2004-04-28 8:43 ` bangerth at dealii dot org
@ 2004-04-28 11:30 ` giovannibajo at libero dot it
2004-04-28 17:00 ` bangerth at dealii dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-28 11:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-04-28 11:13 -------
(In reply to comment #4)
> f(w); // <-- this is dependent should it not
> wait until instantiation to figure out what
> function it should call?
No, the function name "f" is non-dependent, and unqualified. w is dependent
(its type is W<T>), but this only means that an additional koenig lookup is
performed at instantiation time in the associated namespaces. Since the only
namespace associated is the global one, nothing new is found.
Net result is that ::f() is called.
This is really no different from the example shown in changes.html for GCC
3.4.0 ("non dependent names are not looked up in dependent bases"). It would be
very surprising and wrong if changing a parameter type from (say) "int"
to "W<T>" made another different function to be called.
> just like gcc, but _if I switch on the strict mode_, we get
> g/x> icc -Xc -ansi x.cc
> In ::f()
It's possible that icc non-strict is using MS- or GCC- compatibility mode,
which disables two-stage name lookup.
::f() is the function that should be called. BTW, you can turn this into a link-
time test by removing the body of base::f().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (3 preceding siblings ...)
2004-04-28 11:30 ` giovannibajo at libero dot it
@ 2004-04-28 17:00 ` bangerth at dealii dot org
2004-04-29 0:52 ` [Bug c++/5660] [DR213] " giovannibajo at libero dot it
` (7 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-04-28 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-04-28 16:33 -------
Giovanni, you're right of course. So this is one of the few
places where we don't get name lookup right.
Here's the link test:
------------
template<typename T> void f( T& aT ) {}
struct base {
void f( base& );
};
template <typename T> struct W : public T {
void g( W& w ) { f(w); }
};
int main() {
W<base> wb;
wb.g(wb);
return 0;
}
----------------
icc -Xc -ansi links this fine, gcc's call to ld is missing the function that
the compiler erroneously calls.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (5 preceding siblings ...)
2004-04-29 0:52 ` [Bug c++/5660] [DR213] " giovannibajo at libero dot it
@ 2004-04-29 0:52 ` giovannibajo at libero dot it
2004-08-03 1:45 ` [Bug c++/5660] [DR213] " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-29 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-04-29 00:34 -------
I forgot to say, this is also DR 213, which has TC1 status, so it's approved as
an official defect report of C++98. The resolution adds this text to the
standard to clarify the meaning:
"In the definition of a class template or a member of a class template, if a
base class of the class template depends on a template-parameter, the base
class scope is not examined during unqualified name lookup either at the point
of definition of the class template or member or during an instantiation of the
class template or member."
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (4 preceding siblings ...)
2004-04-28 17:00 ` bangerth at dealii dot org
@ 2004-04-29 0:52 ` giovannibajo at libero dot it
2004-04-29 0:52 ` [Bug c++/5660] " giovannibajo at libero dot it
` (6 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-29 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-04-29 00:38 -------
In fact, a test for this is already present in g++.dg/tc1/dr213.C in mainline,
and it is xfailed at the moment.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|dependant names involving |[DR213] dependant names
|templates & inheritance |involving templates &
| |inheritance
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependant names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (6 preceding siblings ...)
2004-04-29 0:52 ` [Bug c++/5660] " giovannibajo at libero dot it
@ 2004-08-03 1:45 ` pinskia at gcc dot gnu dot org
2004-08-11 8:40 ` [Bug c++/5660] [DR213] dependent " redi at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 1:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-03 01:45 -------
To me, PR 2922 looks very much related.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |2922
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependent names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (7 preceding siblings ...)
2004-08-03 1:45 ` [Bug c++/5660] [DR213] " pinskia at gcc dot gnu dot org
@ 2004-08-11 8:40 ` redi at gcc dot gnu dot org
2005-06-12 19:06 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu dot org @ 2004-08-11 8:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From redi at gcc dot gnu dot org 2004-08-11 08:40 -------
I believe this should also have keyword accepts-invalid, as shown by the
following testcase, which should fail to compile but is accepted by current GCC
template <typename T>
struct A
{
typedef T Type;
void f(Type) {}
};
template <typename T>
struct B : A<T>
{
typedef typename A<T>::Type Type;
void ff(Type t) { f(t); } // XXX
};
template struct B<int>;
The call to f(t) shouldn't find a match, but finds A<T>::f
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |redi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependent names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (8 preceding siblings ...)
2004-08-11 8:40 ` [Bug c++/5660] [DR213] dependent " redi at gcc dot gnu dot org
@ 2005-06-12 19:06 ` pinskia at gcc dot gnu dot org
2005-07-21 4:53 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-12 19:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-12 19:06 -------
*** Bug 22040 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sebor at roguewave dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependent names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (9 preceding siblings ...)
2005-06-12 19:06 ` pinskia at gcc dot gnu dot org
@ 2005-07-21 4:53 ` pinskia at gcc dot gnu dot org
2005-09-04 18:28 ` pinskia at gcc dot gnu dot org
2005-09-20 16:43 ` pinskia at gcc dot gnu dot org
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21 4:53 UTC (permalink / raw)
To: gcc-bugs
--
Bug 5660 depends on bug 2922, which changed state.
Bug 2922 Summary: [DR 197] two-stage lookup for unqualified function calls with type-dependent arguments
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2922
What |Old Value |New Value
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependent names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (10 preceding siblings ...)
2005-07-21 4:53 ` pinskia at gcc dot gnu dot org
@ 2005-09-04 18:28 ` pinskia at gcc dot gnu dot org
2005-09-20 16:43 ` pinskia at gcc dot gnu dot org
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-04 18:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-04 18:28 -------
(In reply to comment #11)
> I believe this should also have keyword accepts-invalid, as shown by the
> following testcase, which should fail to compile but is accepted by current GCC
That looks like a different bug as all other problems here are fixed. Since the orginal example in
comment #0 is fixed, I am closing as fixed for 4.1.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/5660] [DR213] dependent names involving templates & inheritance
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
` (11 preceding siblings ...)
2005-09-04 18:28 ` pinskia at gcc dot gnu dot org
@ 2005-09-20 16:43 ` pinskia at gcc dot gnu dot org
12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-20 16:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-20 16:43 -------
*** Bug 23982 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmarek at suse dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5660
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-09-20 16:43 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020211124602.5660.auroran@dominia.mit.edu>
2003-08-01 20:14 ` [Bug c++/5660] dependant names involving templates & inheritance pinskia at physics dot uc dot edu
2004-04-28 2:06 ` pinskia at gcc dot gnu dot org
2004-04-28 8:43 ` bangerth at dealii dot org
2004-04-28 11:30 ` giovannibajo at libero dot it
2004-04-28 17:00 ` bangerth at dealii dot org
2004-04-29 0:52 ` [Bug c++/5660] [DR213] " giovannibajo at libero dot it
2004-04-29 0:52 ` [Bug c++/5660] " giovannibajo at libero dot it
2004-08-03 1:45 ` [Bug c++/5660] [DR213] " pinskia at gcc dot gnu dot org
2004-08-11 8:40 ` [Bug c++/5660] [DR213] dependent " redi at gcc dot gnu dot org
2005-06-12 19:06 ` pinskia at gcc dot gnu dot org
2005-07-21 4:53 ` pinskia at gcc dot gnu dot org
2005-09-04 18:28 ` pinskia at gcc dot gnu dot org
2005-09-20 16:43 ` pinskia 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).