* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
@ 2004-02-02 19:35 ` giovannibajo at libero dot it
2004-02-02 20:44 ` gcc-bugs at michaelmellor dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-02 19:35 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords|rejects-valid |diagnostic
Summary|[3.3?/3.4/3.5 regression] |A warning could be emitted
|template template argument |if a template parameter of a
|identifier lookup fails |member template is begin
|scoping rules |shadowed by another member
| |of the class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
2004-02-02 19:35 ` [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class giovannibajo at libero dot it
@ 2004-02-02 20:44 ` gcc-bugs at michaelmellor dot com
2004-02-02 21:08 ` gdr at integrable-solutions dot net
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: gcc-bugs at michaelmellor dot com @ 2004-02-02 20:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gcc-bugs at michaelmellor dot com 2004-02-02 20:44 -------
Gabriel Dos Reis writes:
|Well, I don't think GCC is in error. When you define a function (or a
|class) in a class, it gets rewritten as if it where defined outside of
|the class (which is why we get the reevaluation rule I pointed you to
|in a different PR). Now, when you reevaluate the member template
|outside of the class, name lookup is required to find X::C -- see
|14.6.1/5 and 14.6.1/7
14.6.1/5 and 14.6.1/7 refer to "In the definition of a member of a class
template..." and "In the definition of a class template or in the definition
of a member of such a template..." respectively. The example does not have a
class template, it is a member-template.
So AFAICS GCC is wrong.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
2004-02-02 19:35 ` [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class giovannibajo at libero dot it
2004-02-02 20:44 ` gcc-bugs at michaelmellor dot com
@ 2004-02-02 21:08 ` gdr at integrable-solutions dot net
2004-02-02 21:13 ` gdr at integrable-solutions dot net
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-02-02 21:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-02-02 21:08 -------
Subject: Re: [3.3?/3.4/3.5 regression] template template argument identifier lookup fails scoping rules
"gianni at mariani dot ws" <gcc-bugzilla@gcc.gnu.org> writes:
| Giving this problem some more thought - I'm thinking that there
| should be some kind of diagnostic if a template parameter is hidden,
| at least a warning.
Sure, giving a warning controled by -Wshadow is a good idea
(I've been thinking about that this morning while walking to work :-).
| The template parameter is useless (at least next to useless) if it's
| hidden and so this is probably not what the coder expected.
Please remember that a template-parameter can be renammed at will.
In particular, there is no obligation that the template-parameter name
used in the declaration be the same as the one used in the definition.
And the definition can appear very far down in the program (or in
another translation unit. You don't want the members be "leaked" by
whatever names are used in those definitions.
| I'm obviously not the only one who has been or is surprised by this
| behaviour.
Well, we're talking about templates, right? :-)
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (2 preceding siblings ...)
2004-02-02 21:08 ` gdr at integrable-solutions dot net
@ 2004-02-02 21:13 ` gdr at integrable-solutions dot net
2004-02-07 8:25 ` gianni at mariani dot ws
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-02-02 21:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-02-02 21:13 -------
Subject: Re: A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
"gcc-bugs at michaelmellor dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Additional Comments From gcc-bugs at michaelmellor dot com 2004-02-02 20:44 -------
| Gabriel Dos Reis writes:
| |Well, I don't think GCC is in error. When you define a function (or a
| |class) in a class, it gets rewritten as if it where defined outside of
| |the class (which is why we get the reevaluation rule I pointed you to
| |in a different PR). Now, when you reevaluate the member template
| |outside of the class, name lookup is required to find X::C -- see
| |14.6.1/5 and 14.6.1/7
|
| 14.6.1/5 and 14.6.1/7 refer to "In the definition of a member of a class
| template..." and "In the definition of a class template or in the definition
| of a member of such a template..." respectively. The example does not have a
| class template, it is a member-template.
That is the answer from the Core Group.
As I said, the decision of having class members hide template parameters
was an explicit decision made by the committee. Parameters of member
templates are no different.
| So AFAICS GCC is wrong.
No, GCC is not wrong. I just checked with the Core group and John
Spicer said yes, the program is ill-formed.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (3 preceding siblings ...)
2004-02-02 21:13 ` gdr at integrable-solutions dot net
@ 2004-02-07 8:25 ` gianni at mariani dot ws
2004-02-07 8:29 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: gianni at mariani dot ws @ 2004-02-07 8:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gianni at mariani dot ws 2004-02-07 08:25 -------
Given this from William M. Miller - should we now reconsider reverting the
summary to the original one ?
Cut-n-paste from microsoft.public.vc.language ...
............................
That Bugzilla thread ends with an incorrect assertion about what the
"correct" behavior is. It reports that John Spicer agreed that the
sample was ill-formed, but he later recanted that position -- he had
been looking at the wrong example in the voluminous discussion on
the reflector, and when he looked at the example in question, he said
it was well-formed.
Although Gaby has now agreed, I think, that the EDG (Comeau) compiler
has it right, I wouldn't consider the question resolved. There's
been no vote to establish consensus among the core working group, and
at least three major compilers currently get a different answer from
the EDG compiler. Furthermore, I believe Gaby's acceptance of the
EDG resolution is contingent on making the construct ill-formed, so
it won't matter which way the resolution goes. I'm sure this will
be discussed at next month's Standard Committee meeting, and Microsoft
is expected to be represented there. I hope that we'll be able to
come to consensus on the outcome then, but we'll have to wait and see.
-- William M. Miller
The MathWorks, Inc.
..........................
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (4 preceding siblings ...)
2004-02-07 8:25 ` gianni at mariani dot ws
@ 2004-02-07 8:29 ` pinskia at gcc dot gnu dot org
2004-02-07 9:06 ` giovannibajo at libero dot it
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-07 8:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-07 08:29 -------
Suspending until the time comes to reconsider this bug as there is no consensus.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|REOPENED |SUSPENDED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (5 preceding siblings ...)
2004-02-07 8:29 ` pinskia at gcc dot gnu dot org
@ 2004-02-07 9:06 ` giovannibajo at libero dot it
2004-02-07 13:11 ` gdr at integrable-solutions dot net
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-07 9:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-07 09:05 -------
As a reference, the quote comes from: http://tinyurl.com/3bf5z
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (6 preceding siblings ...)
2004-02-07 9:06 ` giovannibajo at libero dot it
@ 2004-02-07 13:11 ` gdr at integrable-solutions dot net
2004-02-14 1:12 ` giovannibajo at libero dot it
2004-03-31 9:38 ` giovannibajo at libero dot it
9 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-02-07 13:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-02-07 13:11 -------
Subject: Re: A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
"gianni at mariani dot ws" <gcc-bugzilla@gcc.gnu.org> writes:
| Given this from William M. Miller - should we now reconsider reverting the
| summary to the original one ?
|
|
| Cut-n-paste from microsoft.public.vc.language ...
| ............................
|
| That Bugzilla thread ends with an incorrect assertion about what the
| "correct" behavior is. It reports that John Spicer agreed that the
| sample was ill-formed, but he later recanted that position -- he had
| been looking at the wrong example in the voluminous discussion on
| the reflector, and when he looked at the example in question, he said
| it was well-formed.
|
| Although Gaby has now agreed, I think, that the EDG (Comeau) compiler
| has it right, I wouldn't consider the question resolved. There's
| been no vote to establish consensus among the core working group, and
| at least three major compilers currently get a different answer from
| the EDG compiler. Furthermore, I believe Gaby's acceptance of the
| EDG resolution is contingent on making the construct ill-formed, so
| it won't matter which way the resolution goes. I'm sure this will
| be discussed at next month's Standard Committee meeting, and Microsoft
| is expected to be represented there. I hope that we'll be able to
| come to consensus on the outcome then, but we'll have to wait and see.
|
| -- William M. Miller
| The MathWorks, Inc.
Sorry for not having updated the info here. I've been meaning to do
that but I was kept occupied by other things.
Yes, Mike's report is an accurate executive summary of the discussion
going on the C++ Core Group reflection (there are other ramifications
but I doubt they would much change the big picture as painted by Mike).
The least that can be said is that the standard description of name
lookup in member function definition is not complete and the syntax of
out-of-class definition of member template is deceiving in that it
does not reflect the scope stack (in Mike's description, I've agreed
on, the scope stack would need to be resuffled at some point before we
start name lookup; and the added constraint Mike alluded to is to
rejected "invalid" template-parameters renaming). There was no vote
to establish consensus, so suspending this PR is the right thing to do.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (7 preceding siblings ...)
2004-02-07 13:11 ` gdr at integrable-solutions dot net
@ 2004-02-14 1:12 ` giovannibajo at libero dot it
2004-03-31 9:38 ` giovannibajo at libero dot it
9 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-14 1:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-14 01:12 -------
Also notice this: http://tinyurl.com/2k2d7. Daveed Vandevoorde raised the issue
with the C++ community.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/13967] A warning could be emitted if a template parameter of a member template is begin shadowed by another member of the class
2004-02-01 23:34 [Bug c++/13967] New: template template argument identifier lookup fails scoping rules gianni at mariani dot ws
` (8 preceding siblings ...)
2004-02-14 1:12 ` giovannibajo at libero dot it
@ 2004-03-31 9:38 ` giovannibajo at libero dot it
9 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-31 9:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-03-31 09:38 -------
*** Bug 14785 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |mdorey at bluearc dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13967
^ permalink raw reply [flat|nested] 12+ messages in thread