public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20330] New: Constructor fails to find base class in specialization
@ 2005-03-05 8:00 igodard at pacbell dot net
2005-03-05 8:01 ` [Bug c++/20330] " igodard at pacbell dot net
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2005-03-05 8:00 UTC (permalink / raw)
To: gcc-bugs
The compiler complains about only one of two specializations that are broadly
identical. I don't see any error in either.
If this example should turn out to actually be invalid, please change this report
to a complaint about the quality of the diagnostic.
Ivan
--
Summary: Constructor fails to find base class in specialization
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
@ 2005-03-05 8:01 ` igodard at pacbell dot net
2005-03-05 8:02 ` igodard at pacbell dot net
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2005-03-05 8:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2005-03-05 08:01 -------
Created an attachment (id=8333)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8333&action=view)
Compiler output (-v -save-temps)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
2005-03-05 8:01 ` [Bug c++/20330] " igodard at pacbell dot net
@ 2005-03-05 8:02 ` igodard at pacbell dot net
2005-03-05 8:05 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2005-03-05 8:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2005-03-05 08:02 -------
Created an attachment (id=8334)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8334&action=view)
Source code (-save-temps) (compressed)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
2005-03-05 8:01 ` [Bug c++/20330] " igodard at pacbell dot net
2005-03-05 8:02 ` igodard at pacbell dot net
@ 2005-03-05 8:05 ` pinskia at gcc dot gnu dot org
2005-03-05 8:19 ` igodard at pacbell dot net
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-05 8:05 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Attachment #8333|application/octet-stream |text/plain
mime type| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
` (2 preceding siblings ...)
2005-03-05 8:05 ` pinskia at gcc dot gnu dot org
@ 2005-03-05 8:19 ` igodard at pacbell dot net
2005-03-05 9:11 ` pcarlini at suse dot de
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2005-03-05 8:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2005-03-05 08:18 -------
Reduced test case:
struct foo { int bar; };
template<int i>
struct bar {};
template<int i>
struct baz : public foo, public bar<i> {
baz() : foo(), bar<i>() {}
};
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
` (3 preceding siblings ...)
2005-03-05 8:19 ` igodard at pacbell dot net
@ 2005-03-05 9:11 ` pcarlini at suse dot de
2005-03-05 9:37 ` igodard at pacbell dot net
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pcarlini at suse dot de @ 2005-03-05 9:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-03-05 09:11 -------
::bar<i>() ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
` (4 preceding siblings ...)
2005-03-05 9:11 ` pcarlini at suse dot de
@ 2005-03-05 9:37 ` igodard at pacbell dot net
2005-03-05 11:33 ` giovannibajo at libero dot it
2005-03-14 16:25 ` bangerth at dealii dot org
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2005-03-05 9:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2005-03-05 09:37 -------
Ref comment #4: yes, using "::" clears the diagnostic, but why does the member
in one base collide with the direct reference to another explict base? Isn't the
base name itself in the derived's scope, superceding the names in the base
scopes? That is, from baz are foo and its member bar in the same scope (which is
apparently what the compiler thinks), or is foo in baz's scope while the member
bar is in baz::foo's as seems more reasonable?
(Yes, I know, reasonableness is non-standard :-)
Ivan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
` (5 preceding siblings ...)
2005-03-05 9:37 ` igodard at pacbell dot net
@ 2005-03-05 11:33 ` giovannibajo at libero dot it
2005-03-14 16:25 ` bangerth at dealii dot org
7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2005-03-05 11:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-03-05 11:32 -------
In fact, "bar" and "foo" should be injected into class scope. Comeau, however,
flag the code as invalid just like GCC does. I do not have a standard handy
now to double-check.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20330] Constructor fails to find base class in specialization
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
` (6 preceding siblings ...)
2005-03-05 11:33 ` giovannibajo at libero dot it
@ 2005-03-14 16:25 ` bangerth at dealii dot org
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2005-03-14 16:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-03-14 16:25 -------
The place to look at is 12.6.2/2:
2 Names in a mem-initializer-id are looked up in the scope of the
constructor's class and, if not found in that scope, are looked up in
the scope containing the constructor's definition. [Note: if the
constructor's class contains a member with the same name as a direct
or virtual base class of the class, a mem-initializer-id naming the
member or base class and composed of a single identifier refers to the
class member. A mem-initializer-id for the hidden base class may be
specified using a qualified name. ] Unless the mem-initializer-id
names a nonstatic data member of the constructor's class or a direct
or virtual base of that class, the mem-initializer is ill-formed. A
mem-initializer-list can initialize a base class using any name that
denotes that base class type.
Obviously, in the scope of the constructor, both the name of the base
class and the name of the member of foo are visible. The standard specifies
that this then denotes the member variable, and the sentence after that
states that this is then an error because the variable is not one of the
present class.
In other words, gcc's behavior is correct even though there would be an
unambiguous resolution in this very particular case.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-03-14 16:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-05 8:00 [Bug c++/20330] New: Constructor fails to find base class in specialization igodard at pacbell dot net
2005-03-05 8:01 ` [Bug c++/20330] " igodard at pacbell dot net
2005-03-05 8:02 ` igodard at pacbell dot net
2005-03-05 8:05 ` pinskia at gcc dot gnu dot org
2005-03-05 8:19 ` igodard at pacbell dot net
2005-03-05 9:11 ` pcarlini at suse dot de
2005-03-05 9:37 ` igodard at pacbell dot net
2005-03-05 11:33 ` giovannibajo at libero dot it
2005-03-14 16:25 ` 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).