public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66109] New: defining constexpr objects without initializer
@ 2015-05-11 16:36 vgheorgh at gmail dot com
2015-05-11 16:37 ` [Bug c++/66109] " vgheorgh at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vgheorgh at gmail dot com @ 2015-05-11 16:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66109
Bug ID: 66109
Summary: defining constexpr objects without initializer
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vgheorgh at gmail dot com
Target Milestone: ---
The following code
struct Foo
{
constexpr Foo() = default;
};
int main()
{
constexpr Foo foo;
}
should not compile. Unfortunately it compiles with all g++ versions (that
support c++11) up to and including 5.1
>From [decl.constexpr]:
A constexpr specifier used in an object declaration declares the object as
const. Such an object shall have literal type and shall be initialized.
Therefore the correct way of usage should be
constexpr Foo foo{};
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66109] defining constexpr objects without initializer
2015-05-11 16:36 [Bug c++/66109] New: defining constexpr objects without initializer vgheorgh at gmail dot com
@ 2015-05-11 16:37 ` vgheorgh at gmail dot com
2015-05-11 16:58 ` vgheorgh at gmail dot com
2015-05-11 18:29 ` rs2740 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: vgheorgh at gmail dot com @ 2015-05-11 16:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66109
--- Comment #1 from Vlad Gheorghiu <vgheorgh at gmail dot com> ---
Actually the `constexpr` ctor is not even necessary here to reproduce the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66109] defining constexpr objects without initializer
2015-05-11 16:36 [Bug c++/66109] New: defining constexpr objects without initializer vgheorgh at gmail dot com
2015-05-11 16:37 ` [Bug c++/66109] " vgheorgh at gmail dot com
@ 2015-05-11 16:58 ` vgheorgh at gmail dot com
2015-05-11 18:29 ` rs2740 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: vgheorgh at gmail dot com @ 2015-05-11 16:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66109
--- Comment #2 from Vlad Gheorghiu <vgheorgh at gmail dot com> ---
More details at http://stackoverflow.com/q/30172483/3093378
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66109] defining constexpr objects without initializer
2015-05-11 16:36 [Bug c++/66109] New: defining constexpr objects without initializer vgheorgh at gmail dot com
2015-05-11 16:37 ` [Bug c++/66109] " vgheorgh at gmail dot com
2015-05-11 16:58 ` vgheorgh at gmail dot com
@ 2015-05-11 18:29 ` rs2740 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: rs2740 at gmail dot com @ 2015-05-11 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66109
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #3 from TC <rs2740 at gmail dot com> ---
Dup of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-11 18:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 16:36 [Bug c++/66109] New: defining constexpr objects without initializer vgheorgh at gmail dot com
2015-05-11 16:37 ` [Bug c++/66109] " vgheorgh at gmail dot com
2015-05-11 16:58 ` vgheorgh at gmail dot com
2015-05-11 18:29 ` rs2740 at gmail 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).