"subscript of pointer to function type %0">;
def err_subscript_incomplete_type : Error<
"subscript of pointer to incomplete type %0">;
+def err_dereference_incomplete_type : Error<
+ "dereference of pointer to incomplete type %0">;
def ext_gnu_subscript_void_type : Extension<
"subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
def err_typecheck_member_reference_struct_union : Error<
// Check that the output exprs are valid lvalues.
Expr *OutputExpr = Exprs[i];
- if (CheckAsmLValue(OutputExpr, *this)) {
+ if (CheckAsmLValue(OutputExpr, *this))
return StmtError(Diag(OutputExpr->getLocStart(),
- diag::err_asm_invalid_lvalue_in_output)
- << OutputExpr->getSourceRange());
- }
+ diag::err_asm_invalid_lvalue_in_output)
+ << OutputExpr->getSourceRange());
+
+ if (RequireCompleteType(OutputExpr->getLocStart(), Exprs[i]->getType(), 0))
+ return StmtError(Diag(OutputExpr->getLocStart(),
+ diag::err_dereference_incomplete_type)
+ << Exprs[i]->getType());
OutputConstraintInfos.push_back(Info);
}
InputConstraintInfos.push_back(Info);
const Type *Ty = Exprs[i]->getType().getTypePtr();
- if (Ty->isDependentType() ||
- RequireCompleteType(InputExpr->getLocStart(),
- Exprs[i]->getType(), 0))
+ if (Ty->isDependentType())
continue;
+ if (!Ty->isVoidType() || !Info.allowsMemory())
+ if (RequireCompleteType(InputExpr->getLocStart(), Exprs[i]->getType(), 0))
+ return StmtError(Diag(InputExpr->getLocStart(),
+ diag::err_dereference_incomplete_type)
+ << Exprs[i]->getType());
+
unsigned Size = Context.getTypeSize(Ty);
if (!Context.getTargetInfo().validateInputSize(Literal->getString(),
Size))
void *esp;
__asm__ volatile ("mov %%esp, %o" : "=r"(esp) : : ); // expected-error {{invalid % escape in inline assembly string}}
}
+
+// <rdar://problem/12700799>
+struct S;
+void test14(struct S *s) {
+ __asm("": : "a"(*s)); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
+ __asm("": "=a" (*s) :); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
+}