r179516 - Properly check for a constant initializer for a thread-local variable.

Richard Smith richard-llvm at metafoo.co.uk
Mon Apr 15 01:07:35 PDT 2013


Author: rsmith
Date: Mon Apr 15 03:07:34 2013
New Revision: 179516

URL: http://llvm.org/viewvc/llvm-project?rev=179516&view=rev
Log:
Properly check for a constant initializer for a thread-local variable.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/thread-specifier.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=179516&r1=179515&r2=179516&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Apr 15 03:07:34 2013
@@ -7630,7 +7630,8 @@ void Sema::AddInitializerToDecl(Decl *Re
     else if (VDecl->getTLSKind() == VarDecl::TLS_Static &&
              !VDecl->isInvalidDecl() && !DclT->isDependentType() &&
              !Init->isValueDependent() && !VDecl->isConstexpr() &&
-             !Init->isEvaluatable(Context)) {
+             !Init->isConstantInitializer(
+                 Context, VDecl->getType()->isReferenceType())) {
       // GNU C++98 edits for __thread, [basic.start.init]p4:
       //   An object of thread storage duration shall not require dynamic
       //   initialization.

Modified: cfe/trunk/test/Sema/thread-specifier.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/thread-specifier.c?rev=179516&r1=179515&r2=179516&view=diff
==============================================================================
--- cfe/trunk/test/Sema/thread-specifier.c (original)
+++ cfe/trunk/test/Sema/thread-specifier.c Mon Apr 15 03:07:34 2013
@@ -108,3 +108,5 @@ __thread S s;
 #endif
 #endif
 #endif
+
+__thread int aggregate[10] = {0};





More information about the cfe-commits mailing list