if (getNumArgs())
S += ", ";
S += "...";
- } else if (getNumArgs() == 0) {
+ } else if (getNumArgs() == 0 && !Policy.CPlusPlus) {
// Do not emit int() if we have a proto, emit 'int(void)'.
S += "void";
}
// Not va_list.
Ty.getUnqualifiedType() != Context.getBuiltinVaListType()) {
S = "'"+S+"' (aka '";
- S += DesugaredTy.getAsString();
+ S += DesugaredTy.getAsString(Context.PrintingPolicy);
S += "')";
Output.append(S.begin(), S.end());
return;
int x, *px;
// Type id.
- (T())x; // expected-error {{used type 'T (void)'}}
- (T())+x; // expected-error {{used type 'T (void)'}}
- (T())*px; // expected-error {{used type 'T (void)'}}
+ (T())x; // expected-error {{used type 'T ()'}}
+ (T())+x; // expected-error {{used type 'T ()'}}
+ (T())*px; // expected-error {{used type 'T ()'}}
// Expression.
x = (T());
// Function pointers.
f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}}
void (A::*mfn)() = 0;
- (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (struct A::*)(void)', which is not a reference, pointer-to-object, or pointer-to-data-member}}
+ (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (struct A::*)()', which is not a reference, pointer-to-object, or pointer-to-data-member}}
return **var3;
}
(int(1)); // expected-warning {{expression result unused}}
// type-id
- (int())1; // expected-error {{used type 'int (void)' where arithmetic or pointer type is required}}
+ (int())1; // expected-error {{used type 'int ()' where arithmetic or pointer type is required}}
// Declarations.
int fd(T(a)); // expected-warning {{parentheses were disambiguated as a function declarator}}
A *f0();
};
int f0(B *b) {
- return b->f0->f0; // expected-error{{member reference base type 'struct A *(void)' is not a structure or union}} \
+ return b->f0->f0; // expected-error{{member reference base type 'struct A *()' is not a structure or union}} \
// expected-note{{perhaps you meant to call this function}}
}
void (structure::*psf)() = 0;
(void)reinterpret_cast<int (structure::*)()>(psf);
- (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'void (struct structure::*)(void)' is not allowed}}
- (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (struct structure::*)(void)' to 'int struct structure::*' is not allowed}}
+ (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'void (struct structure::*)()' is not allowed}}
+ (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (struct structure::*)()' to 'int struct structure::*' is not allowed}}
// Cannot cast from integers to member pointers, not even the null pointer
// literal.
- (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)(void)' is not allowed}}
+ (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)()' is not allowed}}
(void)reinterpret_cast<int structure::*>(0); // expected-error {{reinterpret_cast from 'int' to 'int struct structure::*' is not allowed}}
}
// Bad code below
(void)static_cast<int*>((const void*)0); // expected-error {{static_cast from 'void const *' to 'int *' casts away constness}}
- (void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)(void)' is not allowed}}
+ (void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)()' is not allowed}}
}
// Member pointer upcast.
void bar(id(^)(void));
void foo(id <NSObject>(^objectCreationBlock)(void)) {
- return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)(void)', expected 'id<NSObject> (^)(void)'}}
+ return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)()', expected 'id<NSObject> (^)()'}}
}
void bar2(id(*)(void));
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
- return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)(void)', expected 'id<NSObject> (*)(void)'}}
+ return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)()', expected 'id<NSObject> (*)()'}}
}
void bar3(id(*)()); // expected-note{{candidate function}}
A<0> *a0;
-A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int (void)'}}
+A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int ()'}}
A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}}