public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor
@ 2012-02-24 11:35 ai.azuma at gmail dot com
2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ai.azuma at gmail dot com @ 2012-02-24 11:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369
Bug #: 52369
Summary: Const-qualified non-class base member and defaulted
default constructor
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ai.azuma@gmail.com
Created attachment 26740
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26740
Output of -v option and preprocessed file
The following ill-formed code is wrongly accepted by GCC 4.7.0 20120218
(experimental).
////////////////////
class B
{
private:
int const v_;
};
class D
: public B
{};
int main()
{
D d;
}
////////////////////
B's default constructor is implicitly-declared and has no ctor-initializer. So,
B::v_ is not designated by any mem-initializer-id and subject to
default-initialization. However, default-initialization of a const-qualified
non-class type is ill-formed. Therefore, the use of B's constructor is
ill-formed (and it should be defined as deleted in -std=c++11 mode), and the
use of D's is also ill-formed.
N.B. A similar (but a bit different) problem seems to have been resolved in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29043 .
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52369] Const-qualified non-class base member and defaulted default constructor
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
@ 2012-02-24 14:06 ` fabien at gcc dot gnu.org
2012-02-24 15:21 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: fabien at gcc dot gnu.org @ 2012-02-24 14:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-02-24
CC| |fabien at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |fabien at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
Known to fail| |4.1.2, 4.2.4, 4.3.6, 4.5.3,
| |4.7.0
--- Comment #1 from fabien at gcc dot gnu.org 2012-02-24 14:05:19 UTC ---
Confirmed.
Can someone please test it on 4.6.0 and 4.6.2 ?
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52369] Const-qualified non-class base member and defaulted default constructor
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
@ 2012-02-24 15:21 ` redi at gcc dot gnu.org
2014-03-26 21:34 ` fabien at gcc dot gnu.org
2014-03-28 15:36 ` fabien at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-24 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-24 14:17:17 UTC ---
With 4.6.2 and -Wall gives the same as 4.7.0:
l.cc:4:13: warning: non-static const member 'const int B::v_' in class without
a constructor [-Wuninitialized]
l.cc: In function 'int main()':
l.cc:13:5: warning: unused variable 'd' [-Wunused-variable]
4.5.2 gives the same (except doesn't print the [-W...] info after the warnings)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52369] Const-qualified non-class base member and defaulted default constructor
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
2012-02-24 15:21 ` redi at gcc dot gnu.org
@ 2014-03-26 21:34 ` fabien at gcc dot gnu.org
2014-03-28 15:36 ` fabien at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-03-26 21:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369
--- Comment #3 from fabien at gcc dot gnu.org ---
Author: fabien
Date: Wed Mar 26 21:33:28 2014
New Revision: 208854
URL: http://gcc.gnu.org/viewcvs?rev=208854&root=gcc&view=rev
Log:
2014-03-26 Fabien Chene <fabien@gcc.gnu.org>
PR c++/52369
* cp/method.c (walk_field_subobs): improve the diagnostic
locations for both REFERENCE_TYPEs and non-static const members.
* cp/init.c (diagnose_uninitialized_cst_or_ref_member): use %q#D
instead of %qD to be consistent with the c++11 diagnostic.
2014-03-26 Fabien Chene <fabien@gcc.gnu.org>
PR c++/52369
* g++.dg/init/const10.C: New.
* g++.dg/init/const11.C: New.
* g++.dg/init/pr25811.C: Adjust.
* g++.dg/init/pr29043.C: Likewise.
* g++.dg/init/pr43719.C: Likewise.
* g++.dg/init/pr44086.C: Likewise.
* g++.dg/init/ctor8.C: Likewise.
* g++.dg/init/uninitialized1.C: Likewise.
Added:
trunk/gcc/testsuite/g++.dg/init/const10.C
trunk/gcc/testsuite/g++.dg/init/const11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/cp/method.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/init/ctor8.C
trunk/gcc/testsuite/g++.dg/init/pr25811.C
trunk/gcc/testsuite/g++.dg/init/pr29043.C
trunk/gcc/testsuite/g++.dg/init/pr43719.C
trunk/gcc/testsuite/g++.dg/init/pr44086.C
trunk/gcc/testsuite/g++.dg/init/uninitialized1.C
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52369] Const-qualified non-class base member and defaulted default constructor
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
` (2 preceding siblings ...)
2014-03-26 21:34 ` fabien at gcc dot gnu.org
@ 2014-03-28 15:36 ` fabien at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-03-28 15:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.8.3
--- Comment #4 from fabien at gcc dot gnu.org ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-28 15:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
2012-02-24 15:21 ` redi at gcc dot gnu.org
2014-03-26 21:34 ` fabien at gcc dot gnu.org
2014-03-28 15:36 ` fabien at gcc dot gnu.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).