[Sema] Fix assertion hit while trying to do constant evaluation for a dependent expression

inside a GNU statement expression.

rdar://16064952

llvm-svn: 201468
This commit is contained in:
Argyrios Kyrtzidis 2014-02-15 18:53:57 +00:00
parent f28703a181
commit 90181d6180
2 changed files with 10 additions and 0 deletions

View File

@ -8028,6 +8028,8 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
/// an object can indirectly refer to subobjects which were initialized earlier.
static bool EvaluateInPlace(APValue &Result, EvalInfo &Info, const LValue &This,
const Expr *E, bool AllowNonLiteralTypes) {
if (E->isTypeDependent() || E->isValueDependent())
return false;
if (!AllowNonLiteralTypes && !CheckLiteralType(Info, E, &This))
return false;

View File

@ -133,3 +133,11 @@ namespace test4 {
// equivalent to "const int x = 42;" as per C++03 8.5/p13.
typedef A<i> Ai; // ok
}
// rdar://16064952
namespace rdar16064952 {
template < typename T > void fn1() {
T b;
unsigned w = ({int a = b.val[sizeof(0)]; 0; }); // expected-warning {{use of GNU statement expression extension}}
}
}