public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32066] member/type lookup doesn't work properly with templates
[not found] <bug-32066-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-09 2:25 ` pinskia at gcc dot gnu.org
2021-12-09 7:40 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09 2:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schaub.johannes@googlemail.
| |com
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 48920 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/32066] member/type lookup doesn't work properly with templates
[not found] <bug-32066-4@http.gcc.gnu.org/bugzilla/>
2021-12-09 2:25 ` [Bug c++/32066] member/type lookup doesn't work properly with templates pinskia at gcc dot gnu.org
@ 2021-12-09 7:40 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 58590 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/32066] member/type lookup doesn't work properly with templates
2007-05-24 10:27 [Bug c++/32066] New: " andrew dot stubbs at st dot com
2009-12-07 8:13 ` [Bug c++/32066] " christian dot bruel at st dot com
2009-12-07 15:11 ` redi at gcc dot gnu dot org
@ 2009-12-07 16:41 ` christian dot bruel at st dot com
2 siblings, 0 replies; 5+ messages in thread
From: christian dot bruel at st dot com @ 2009-12-07 16:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from christian dot bruel at st dot com 2009-12-07 16:41 -------
> The test can be reduced to this, which should not compile:
>
> struct A {
> struct X { };
> int X;
> };
> template<class T> void f(T t) {
> typename T::X x;
> }
> void foo() {
> A a;
> f(a); // error: T::X refers to the data member A::X not the struct A::X
> }
>
OK. note that with the original tests, 'int X' was declared static.
That makes the case a little bit different since 3.3.7.2 refers to "object,
function or enumerator", not class member.
So variants of this case have declarations:
struct A {
struct X { };
enum x {a, b, c} X;
};
and
struct A {
struct X { };
void X();
};
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/32066] member/type lookup doesn't work properly with templates
2007-05-24 10:27 [Bug c++/32066] New: " andrew dot stubbs at st dot com
2009-12-07 8:13 ` [Bug c++/32066] " christian dot bruel at st dot com
@ 2009-12-07 15:11 ` redi at gcc dot gnu dot org
2009-12-07 16:41 ` christian dot bruel at st dot com
2 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-12-07 15:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from redi at gcc dot gnu dot org 2009-12-07 15:11 -------
(In reply to comment #1)
> I'm wondering if this is not an application of the name hiding rule described
> in the IEC 14882:1998 (3.3.7) that says here that the class name T::X is hidden
> by the object static int T::X i, so T::X y refers to the object's name not the
> class.
Exactly. The point is that the standard says "The usual qualified name
lookup (3.4.3) is used to find the qualified-id even in the presence of
typename."
> Making the test invalid. Not certain, just a thought.
The test is supposed to be invalid, but should give an error on line 6 and line
7, GCC only gives an error on line 7.
> This could be reduced as ...
Your reduced version is irrelevant because it's not a template and there's no
"typename" keyword. GCC gets that right, but doesn't get the original report
right.
The test can be reduced to this, which should not compile:
struct A {
struct X { };
int X;
};
template<class T> void f(T t) {
typename T::X x;
}
void foo() {
A a;
f(a); // error: T::X refers to the data member A::X not the struct A::X
}
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Known to fail| |4.1.2 4.4.2
Last reconfirmed|0000-00-00 00:00:00 |2009-12-07 15:11:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/32066] member/type lookup doesn't work properly with templates
2007-05-24 10:27 [Bug c++/32066] New: " andrew dot stubbs at st dot com
@ 2009-12-07 8:13 ` christian dot bruel at st dot com
2009-12-07 15:11 ` redi at gcc dot gnu dot org
2009-12-07 16:41 ` christian dot bruel at st dot com
2 siblings, 0 replies; 5+ messages in thread
From: christian dot bruel at st dot com @ 2009-12-07 8:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from christian dot bruel at st dot com 2009-12-07 08:13 -------
I'm wondering if this is not an application of the name hiding rule described
in the IEC 14882:1998 (3.3.7) that says here that the class name T::X is hidden
by the object static int T::X i, so T::X y refers to the object's name not the
class. Making the test invalid. Not certain, just a thought.
This could be reduced as
struct A
{
#ifdef X_MEMBER
static int X;
#endif
#ifdef X_NAME
struct X { };
#endif
} ;
void foo(void)
{
#ifdef X_NAME
A::X y;
#endif
#ifdef X_MEMBER
A::X = 1;
#endif
}
if both X_NAME and X_MEMBER are defined the line A::X y; becomes invalid.
--
christian dot bruel at st dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |christian dot bruel at st
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32066
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-09 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-32066-4@http.gcc.gnu.org/bugzilla/>
2021-12-09 2:25 ` [Bug c++/32066] member/type lookup doesn't work properly with templates pinskia at gcc dot gnu.org
2021-12-09 7:40 ` pinskia at gcc dot gnu.org
2007-05-24 10:27 [Bug c++/32066] New: " andrew dot stubbs at st dot com
2009-12-07 8:13 ` [Bug c++/32066] " christian dot bruel at st dot com
2009-12-07 15:11 ` redi at gcc dot gnu dot org
2009-12-07 16:41 ` christian dot bruel at st dot com
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).