* semantics.c (finish_omp_threadprivate): Call complete_type.
authorJason Merrill <jason@redhat.com>
Thu, 25 Oct 2012 15:53:40 +0000 (11:53 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 25 Oct 2012 15:53:40 +0000 (11:53 -0400)
From-SVN: r192812

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/gomp/tls-template1.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/tls-init1.C

index 38e79f58e6eaed3696eddeb5041c1e376bf25b79..278a668964d0dda84e572a459a0b87ae8592274e 100644 (file)
@@ -1,5 +1,7 @@
 2012-10-25  Jason Merrill  <jason@redhat.com>
 
+       * semantics.c (finish_omp_threadprivate): Call complete_type.
+
        * class.c (one_inherited_ctor): Warn about variadic inherited ctor.
 
 2012-10-25  Marc Glisse  <marc.glisse@inria.fr>
index 63b364c37de6cf78f919b1e09104499ee7188f5f..073ee97be9c5d5269c724cdfafb2a9bff59c2cc0 100644 (file)
@@ -4360,7 +4360,7 @@ finish_omp_threadprivate (tree vars)
        error ("%qE declared %<threadprivate%> after first use", v);
       else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v))
        error ("automatic variable %qE cannot be %<threadprivate%>", v);
-      else if (! COMPLETE_TYPE_P (TREE_TYPE (v)))
+      else if (! COMPLETE_TYPE_P (complete_type (TREE_TYPE (v))))
        error ("%<threadprivate%> %qE has incomplete type", v);
       else if (TREE_STATIC (v) && TYPE_P (CP_DECL_CONTEXT (v))
               && CP_DECL_CONTEXT (v) != current_class_type)
diff --git a/gcc/testsuite/g++.dg/gomp/tls-template1.C b/gcc/testsuite/g++.dg/gomp/tls-template1.C
new file mode 100644 (file)
index 0000000..5865ce3
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-require-effective-target tls }
+
+template <class T> struct B
+{
+  T t;
+};
+
+class A {
+    static B<int> b;
+#pragma omp threadprivate(b)
+};
+
+B<int> A::b;
index 4cbaccb98511a1a89ea88e41f1aac8697f2a8842..d62e96b95bfa165865afc3d40dfaa8df1045f657 100644 (file)
@@ -1,3 +1,5 @@
+// { dg-require-alias }
+
 extern "C" void abort();
 
 struct A