[llvm-branch-commits] [cfe-branch] r204050 - Merging r200954:

Tom Stellard thomas.stellard at amd.com
Mon Mar 17 09:39:03 PDT 2014


Author: tstellar
Date: Mon Mar 17 11:39:03 2014
New Revision: 204050

URL: http://llvm.org/viewvc/llvm-project?rev=204050&view=rev
Log:
Merging r200954:

------------------------------------------------------------------------
r200954 | richard-llvm | 2014-02-06 15:35:16 -0800 (Thu, 06 Feb 2014) | 9 lines

Temporary fix for PR18473: Don't try to evaluate the initializer for a
type-dependent variable, even if the initializer isn't value-dependent.  This
happens for ParenListExprs composed of non-value-dependent subexpressions, for
instance.

We should really give ParenListExprs (and InitListExprs) the type of the
initialized entity if they're used to represent a dependent initialization (and
if so, set them to be type-, value- and instantiation-dependent).

Modified:
    cfe/branches/release_34/lib/Sema/SemaExprCXX.cpp
    cfe/branches/release_34/test/SemaCXX/lambda-expressions.cpp

Modified: cfe/branches/release_34/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Sema/SemaExprCXX.cpp?rev=204050&r1=204049&r2=204050&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/release_34/lib/Sema/SemaExprCXX.cpp Mon Mar 17 11:39:03 2014
@@ -5836,17 +5836,16 @@ static inline bool VariableCanNeverBeACo
   assert(DefVD);
   if (DefVD->isWeak()) return false;
   EvaluatedStmt *Eval = DefVD->ensureEvaluatedStmt();
-  
+
   Expr *Init = cast<Expr>(Eval->Value);
 
   if (Var->getType()->isDependentType() || Init->isValueDependent()) {
-    if (!Init->isValueDependent())
-      return !DefVD->checkInitIsICE();
-    // FIXME: We might still be able to do some analysis of Init here
-    // to conclude that even in a dependent setting, Init can never
-    // be a constexpr - but for now admit agnosticity.
+    // FIXME: Teach the constant evaluator to deal with the non-dependent parts
+    // of value-dependent expressions, and use it here to determine whether the
+    // initializer is a potential constant expression.
     return false;
-  } 
+  }
+
   return !IsVariableAConstantExpression(Var, Context); 
 }
 

Modified: cfe/branches/release_34/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/SemaCXX/lambda-expressions.cpp?rev=204050&r1=204049&r2=204050&view=diff
==============================================================================
--- cfe/branches/release_34/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/branches/release_34/test/SemaCXX/lambda-expressions.cpp Mon Mar 17 11:39:03 2014
@@ -282,4 +282,19 @@ namespace lambdas_in_NSDMIs {
     };
     L l; 
   }
-}
\ No newline at end of file
+}
+
+namespace PR18473 {
+  template<typename T> void f() {
+    T t(0);
+    (void) [=]{ int n = t; }; // expected-error {{deleted}}
+  }
+
+  template void f<int>();
+  struct NoCopy {
+    NoCopy(int);
+    NoCopy(const NoCopy &) = delete; // expected-note {{deleted}}
+    operator int() const;
+  };
+  template void f<NoCopy>(); // expected-note {{instantiation}}
+}





More information about the llvm-branch-commits mailing list