public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body
@ 2015-05-02 20:15 rhalbersma at gmail dot com
2015-05-02 20:19 ` [Bug c++/65985] " rhalbersma at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rhalbersma at gmail dot com @ 2015-05-02 20:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65985
Bug ID: 65985
Summary: compiler segfault with assert() in constexpr
constructor body
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rhalbersma at gmail dot com
Target Milestone: ---
The following code segfaults with -std=c++1y for g++ 5.1.0 and trunk 20150502
on the combination of constexpr and assert() in the constructor body (removing
either the constexpr keyword everywhere or the assert() will compile cleanly).
#include <cassert>
class Angle
{
int degrees = 0;
constexpr auto invariant() const noexcept
{
return 0 <= degrees && degrees < 360;
}
public:
explicit constexpr Angle(int n) noexcept
:
degrees{n % 360}
{
assert(invariant());
}
/* implicit */ constexpr operator auto() const noexcept
{
return degrees;
}
};
int main()
{
static_assert(Angle{360} == 0, "");
}
This code correctly compiles with -std=c++14 from Clang 3.3 and higher.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/65985] compiler segfault with assert() in constexpr constructor body
2015-05-02 20:15 [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body rhalbersma at gmail dot com
@ 2015-05-02 20:19 ` rhalbersma at gmail dot com
2015-05-04 10:36 ` [Bug c++/65985] [5/6 Regression] " mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rhalbersma at gmail dot com @ 2015-05-02 20:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65985
--- Comment #1 from rhalbersma <rhalbersma at gmail dot com> ---
See also LWG active issue 2234
http://cplusplus.github.io/LWG/lwg-active.html#2234
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/65985] [5/6 Regression] compiler segfault with assert() in constexpr constructor body
2015-05-02 20:15 [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body rhalbersma at gmail dot com
2015-05-02 20:19 ` [Bug c++/65985] " rhalbersma at gmail dot com
@ 2015-05-04 10:36 ` mpolacek at gcc dot gnu.org
2015-05-04 10:46 ` mpolacek at gcc dot gnu.org
2015-05-04 11:28 ` daniel.kruegler at googlemail dot com
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-04 10:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65985
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |5.2
Summary|compiler segfault with |[5/6 Regression] compiler
|assert() in constexpr |segfault with assert() in
|constructor body |constexpr constructor body
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/65985] [5/6 Regression] compiler segfault with assert() in constexpr constructor body
2015-05-02 20:15 [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body rhalbersma at gmail dot com
2015-05-02 20:19 ` [Bug c++/65985] " rhalbersma at gmail dot com
2015-05-04 10:36 ` [Bug c++/65985] [5/6 Regression] " mpolacek at gcc dot gnu.org
@ 2015-05-04 10:46 ` mpolacek at gcc dot gnu.org
2015-05-04 11:28 ` daniel.kruegler at googlemail dot com
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-04 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65985
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Actually I think it's a dup.
*** This bug has been marked as a duplicate of bug 65973 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/65985] [5/6 Regression] compiler segfault with assert() in constexpr constructor body
2015-05-02 20:15 [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body rhalbersma at gmail dot com
` (2 preceding siblings ...)
2015-05-04 10:46 ` mpolacek at gcc dot gnu.org
@ 2015-05-04 11:28 ` daniel.kruegler at googlemail dot com
3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2015-05-04 11:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65985
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Marek Polacek from comment #3)
> Actually I think it's a dup.
Can we nonetheless ensure that the assert example would become a test case?
>From gcc-bugs-return-485367-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 04 11:32:16 2015
Return-Path: <gcc-bugs-return-485367-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 130019 invoked by alias); 4 May 2015 11:32:16 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 129972 invoked by uid 48); 4 May 2015 11:32:13 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65973] [5/6 Regression] segmentation fault when compiling C++14 code
Date: Mon, 04 May 2015 11:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65973-4-8c3aDVs4TE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65973-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65973-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00207.txt.bz2
Content-length: 185
https://gcc.gnu.org/bugzilla/show_bug.cgi?ide973
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
When fixing this, remember to also add the testcase in PR65985.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-04 11:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-02 20:15 [Bug c++/65985] New: compiler segfault with assert() in constexpr constructor body rhalbersma at gmail dot com
2015-05-02 20:19 ` [Bug c++/65985] " rhalbersma at gmail dot com
2015-05-04 10:36 ` [Bug c++/65985] [5/6 Regression] " mpolacek at gcc dot gnu.org
2015-05-04 10:46 ` mpolacek at gcc dot gnu.org
2015-05-04 11:28 ` daniel.kruegler at googlemail dot com
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).