Merge branch 'master' into nvptx_merge

This commit is contained in:
evghenii
2014-07-07 16:30:12 +02:00
29 changed files with 397 additions and 231 deletions

View File

@@ -5143,9 +5143,18 @@ MemberExpr::create(Expr *e, const char *id, SourcePos p, SourcePos idpos,
exprType->GetString().c_str());
return NULL;
}
if (CastType<StructType>(exprType) != NULL)
if (CastType<StructType>(exprType) != NULL) {
const StructType *st = CastType<StructType>(exprType);
if (st->IsDefined()) {
return new StructMemberExpr(e, id, p, idpos, derefLValue);
}
else {
Error(p, "Member operator \"%s\" can't be applied to declared "
"struct \"%s\" containing an undefined struct type.", derefLValue ? "->" : ".",
exprType->GetString().c_str());
return NULL;
}
}
else if (CastType<VectorType>(exprType) != NULL)
return new VectorMemberExpr(e, id, p, idpos, derefLValue);
else if (CastType<UndefinedStructType>(exprType)) {
@@ -8719,6 +8728,12 @@ NewExpr::TypeCheck() {
"but not defined type \"%s\".", allocType->GetString().c_str());
return NULL;
}
const StructType *st = CastType<StructType>(allocType);
if (st != NULL && !st->IsDefined()) {
Error(pos, "Can't dynamically allocate storage for declared "
"type \"%s\" containing undefined member type.", allocType->GetString().c_str());
return NULL;
}
// Otherwise we only need to make sure that if we have an expression
// giving a number of elements to allocate that it can be converted to