PR c++/61343
* decl.c (check_initializer): Maybe clear
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
From-SVN: r211284
+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
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;
--- /dev/null
+// 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();
+}