public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
@ 2011-12-20 8:04 reichelt at gcc dot gnu.org
2011-12-20 8:22 ` [Bug c++/51633] " reichelt at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu.org @ 2011-12-20 8:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
Bug #: 51633
Summary: [c++0x] [4.6/4.7 Regression] ICE with invalid
constexpr constructor
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: reichelt@gcc.gnu.org
The following invalid code snippet triggers an ICE since GCC 4.6.0:
==========================
struct A
{
~A();
};
struct B
{
A a;
constexpr B() {}
};
==========================
bug.cc: In constructor 'constexpr B::B()':
bug.cc:9:18: internal compiler error: in
build_constexpr_constructor_member_initializers, at cp/semantics.c:5908
Please submit a full bug report, [etc.]
A slightly different code snippet triggers an ICE in a different place:
==========================
struct A
{
constexpr A() {}
~A();
};
struct B
{
A a;
constexpr B() { return; }
};
==========================
bug.cc: In constructor 'constexpr B::B()':
bug.cc:10:27: internal compiler error: in build_data_member_initialization, at
cp/semantics.c:5782
Please submit a full bug report, [etc.]
This looks related to PR51612 where the ICE happens in the same place.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
@ 2011-12-20 8:22 ` reichelt at gcc dot gnu.org
2011-12-20 10:39 ` paolo.carlini at oracle dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu.org @ 2011-12-20 8:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
Volker Reichelt <reichelt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
Target Milestone|--- |4.6.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
2011-12-20 8:22 ` [Bug c++/51633] " reichelt at gcc dot gnu.org
@ 2011-12-20 10:39 ` paolo.carlini at oracle dot com
2011-12-30 6:31 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-20 10:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-20 10:30:39 UTC ---
By the way, calling these issues "Regression" doesn't seem appropriate:
granted, 4.5 may have parsed some constrexpr usages, but didn't have any
semantics implemented, could very hardly fail.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
2011-12-20 8:22 ` [Bug c++/51633] " reichelt at gcc dot gnu.org
2011-12-20 10:39 ` paolo.carlini at oracle dot com
@ 2011-12-30 6:31 ` pinskia at gcc dot gnu.org
2012-01-01 13:54 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-30 6:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-30 06:20:47 UTC ---
(In reply to comment #1)
> By the way, calling these issues "Regression" doesn't seem appropriate:
> granted, 4.5 may have parsed some constrexpr usages, but didn't have any
> semantics implemented, could very hardly fail.
In the past we decided accepts invalid changing into an ICE is a regression
which is why this was considered a regression (I Can find the previous bug
reports that mention that).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2011-12-30 6:31 ` pinskia at gcc dot gnu.org
@ 2012-01-01 13:54 ` paolo.carlini at oracle dot com
2012-01-04 13:50 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-01 13:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-01 13:54:44 UTC ---
Bah...
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2012-01-01 13:54 ` paolo.carlini at oracle dot com
@ 2012-01-04 13:50 ` rguenth at gcc dot gnu.org
2012-01-09 18:41 ` dodji at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-04 13:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2012-01-04 13:50 ` rguenth at gcc dot gnu.org
@ 2012-01-09 18:41 ` dodji at gcc dot gnu.org
2012-01-11 13:23 ` dodji at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-01-09 18:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
Dodji Seketeli <dodji at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-01-09
CC| |dodji at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |dodji at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2012-01-09 18:41 ` dodji at gcc dot gnu.org
@ 2012-01-11 13:23 ` dodji at gcc dot gnu.org
2012-01-11 13:54 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-01-11 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-01-11 13:22:55 UTC ---
It seems to me that the first example might actually be considered as
valid.
One non-fully clear reason why it could have been considered invalid
in the first place is tat the constructor of B does not explicitly
initialize a.
But then A doesn't have any member. So we can say in the end that "B
doesn't have any non-initialized member". And that can be argued to
comply with this relevant pre-requisite for constexpr constructors in
[dcl.constexpr]/8:
every non-static data member and base class sub-object shall be
initialized
I have discussed this with Jason off-line and he seems to agree.
Thought anyone?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (6 preceding siblings ...)
2012-01-11 13:23 ` dodji at gcc dot gnu.org
@ 2012-01-11 13:54 ` jason at gcc dot gnu.org
2012-01-12 23:30 ` dodji at gcc dot gnu.org
2012-01-12 23:34 ` dodji at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-11 13:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-11 13:52:11 UTC ---
The testcase is valid because A's implicitly-declared default constructor is
constexpr. We just need to fix build_constexpr_member_initializers to deal
with the trees that we get for B().
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (7 preceding siblings ...)
2012-01-11 13:54 ` jason at gcc dot gnu.org
@ 2012-01-12 23:30 ` dodji at gcc dot gnu.org
2012-01-12 23:34 ` dodji at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-01-12 23:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
--- Comment #6 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-01-12 23:28:52 UTC ---
Author: dodji
Date: Thu Jan 12 23:28:46 2012
New Revision: 183144
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183144
Log:
PR c++/51633 - ICEs with constexpr constructor
gcc/cp/
PR c++/51633
* semantics.c (cp_parser_ctor_initializer_opt_and_function_body):
Set the pointer to the last block of the constructor to the
current statement.
(build_constexpr_constructor_member_initializers): Get
build_data_member_initialization a chance to deal with more
statements before we choke.
gcc/testsuite/
PR c++/51633
* g++.dg/cpp0x/constexpr-diag4.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-diag4.C
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-diag5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51633] [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
` (8 preceding siblings ...)
2012-01-12 23:30 ` dodji at gcc dot gnu.org
@ 2012-01-12 23:34 ` dodji at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-01-12 23:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51633
Dodji Seketeli <dodji at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-01-12 23:34:16 UTC ---
Should be fixed in trunk (4.7).
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-01-12 23:34 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 8:04 [Bug c++/51633] New: [c++0x] [4.6/4.7 Regression] ICE with invalid constexpr constructor reichelt at gcc dot gnu.org
2011-12-20 8:22 ` [Bug c++/51633] " reichelt at gcc dot gnu.org
2011-12-20 10:39 ` paolo.carlini at oracle dot com
2011-12-30 6:31 ` pinskia at gcc dot gnu.org
2012-01-01 13:54 ` paolo.carlini at oracle dot com
2012-01-04 13:50 ` rguenth at gcc dot gnu.org
2012-01-09 18:41 ` dodji at gcc dot gnu.org
2012-01-11 13:23 ` dodji at gcc dot gnu.org
2012-01-11 13:54 ` jason at gcc dot gnu.org
2012-01-12 23:30 ` dodji at gcc dot gnu.org
2012-01-12 23:34 ` dodji 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).