through varargs. This only happens when we're in an unevaluated
context, where we don't want to trigger an error anyway. Fixes PR11131
/ <rdar://problem/
10288375>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141986
91177308-0d34-0410-b5e6-
96231b3b80d8
<< E->getType() << CT))
return ExprError();
- if (!E->getType().isPODType(Context)) {
+ // Complain about passing non-POD types through varargs. However, don't
+ // perform this check for incomplete types, which we can get here when we're
+ // in an unevaluated context.
+ if (!E->getType()->isIncompleteType() && !E->getType().isPODType(Context)) {
// C++0x [expr.call]p7:
// Passing a potentially-evaluated argument of class type (Clause 9)
// having a non-trivial copy constructor, a non-trivial move constructor,
vararg(x1); // okay
vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}}
}
+
+
+namespace PR11131 {
+ struct S;
+
+ S &getS();
+
+ void f(...);
+
+ void g() {
+ (void)sizeof(f(getS()));
+ }
+}
(void)__builtin_va_arg(list, Abstract); // expected-error{{second argument to 'va_arg' is of abstract type 'Abstract'}}
__builtin_va_end(list);
}
-