Commit f0f2f975 by Jason Merrill Committed by Jason Merrill

re PR c++/61343 ([C++11] Missing default initialization for class with default constructor)

	PR c++/61343
	* decl.c (check_initializer): Maybe clear
	DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.

From-SVN: r211284
parent 5853e181
2014-06-04 Jason Merrill <jason@redhat.com>
PR c++/61343
* decl.c (check_initializer): Maybe clear
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
2014-06-05 Richard Biener <rguenther@suse.de>
PR c++/61004
......
......@@ -5856,6 +5856,13 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
if (init && init != error_mark_node)
init_code = build2 (INIT_EXPR, type, decl, init);
if (init_code)
{
/* We might have set these in cp_finish_decl. */
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = false;
TREE_CONSTANT (decl) = false;
}
if (init_code && DECL_IN_AGGR_P (decl))
{
static int explained = 0;
......
// PR c++/61343
// { dg-do run { target c++11 } }
// { dg-add-options tls }
// { dg-require-effective-target tls_runtime }
struct Foo {
int value;
Foo() noexcept {
value = 12;
}
};
static thread_local Foo a{};
static __attribute__((noinline)) void UseA() {
if (a.value != 12) __builtin_abort();
}
int main() {
UseA();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment