public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29706] New: rejects-valid: missing mem-initializer for virtual base class
@ 2006-11-03 23:08 jens dot maurer at gmx dot net
2006-11-03 23:20 ` [Bug c++/29706] " pinskia at gcc dot gnu dot org
2006-11-04 15:34 ` jens dot maurer at gmx dot net
0 siblings, 2 replies; 3+ messages in thread
From: jens dot maurer at gmx dot net @ 2006-11-03 23:08 UTC (permalink / raw)
To: gcc-bugs
This code snippet
struct V {
V(int) { }
};
struct B : virtual V
{
B() { } // does not mention constructor of V
};
struct D : B
{
D() : V(0) { }
};
D d; // most derived object of type D
should be valid according to the C++ standard 12.6.2 paragraph 6 (note that B
is not a most derived class). However, gcc complains about the definition of
the constructor for B, which is wrong, because the constructor for B is not
used to initialize a most derived object (it only initializes the B subobject
of D):
257-demo.cc: In constructor 'B::B()':
257-demo.cc:7: error: no matching function for call to 'V::V()'
257-demo.cc:2: note: candidates are: V::V(int)
257-demo.cc:1: note: V::V(const V&)
--
Summary: rejects-valid: missing mem-initializer for virtual base
class
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jens dot maurer at gmx dot net
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29706
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/29706] rejects-valid: missing mem-initializer for virtual base class
2006-11-03 23:08 [Bug c++/29706] New: rejects-valid: missing mem-initializer for virtual base class jens dot maurer at gmx dot net
@ 2006-11-03 23:20 ` pinskia at gcc dot gnu dot org
2006-11-04 15:34 ` jens dot maurer at gmx dot net
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-03 23:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-11-03 23:20 -------
I think is really a dup of bug 19249.
Though the problem here is slightly different as B() is fully defined and calls
the default constructor which is not defined.
Comeau C/C++ 4.3.8 (Aug 19 2006 13:36:48) for ONLINE_EVALUATION_Alpha1
Copyright 1988-2006 Comeau Computing. All rights reserved.
MODE:strict errors C++
"ComeauTest.c", line 7: error: no default constructor exists for class "V"
B() { } // does not mention constructor of V
^
That is what comeau online gives.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29706
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/29706] rejects-valid: missing mem-initializer for virtual base class
2006-11-03 23:08 [Bug c++/29706] New: rejects-valid: missing mem-initializer for virtual base class jens dot maurer at gmx dot net
2006-11-03 23:20 ` [Bug c++/29706] " pinskia at gcc dot gnu dot org
@ 2006-11-04 15:34 ` jens dot maurer at gmx dot net
1 sibling, 0 replies; 3+ messages in thread
From: jens dot maurer at gmx dot net @ 2006-11-04 15:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jens dot maurer at gmx dot net 2006-11-04 15:34 -------
I agree it's a duplicate of bug 19249, but I would not limit the discussion to
abstract classes.
*** This bug has been marked as a duplicate of 19249 ***
--
jens dot maurer at gmx dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29706
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-04 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-03 23:08 [Bug c++/29706] New: rejects-valid: missing mem-initializer for virtual base class jens dot maurer at gmx dot net
2006-11-03 23:20 ` [Bug c++/29706] " pinskia at gcc dot gnu dot org
2006-11-04 15:34 ` jens dot maurer at gmx dot net
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).