Based on patch by Grzegorz Jablonski.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166226
91177308-0d34-0410-b5e6-
96231b3b80d8
OS << "::";
OS << "new ";
unsigned NumPlace = E->getNumPlacementArgs();
- if (NumPlace > 0) {
+ if (NumPlace > 0 && !isa<CXXDefaultArgExpr>(E->getPlacementArg(0))) {
OS << "(";
PrintExpr(E->getPlacementArg(0));
for (unsigned i = 1; i < NumPlace; ++i) {
+ if (isa<CXXDefaultArgExpr>(E->getPlacementArg(i)))
+ break;
OS << ", ";
PrintExpr(E->getPlacementArg(i));
}
switch (int a = 1) { }
}
+// CHECK: new (1) int;
+void *operator new (typeof(sizeof(1)), int, int = 2);
+void f2() {
+ new (1) int;
+}
+
+// CHECK: new X;
+struct X {
+ void *operator new (typeof(sizeof(1)), int = 2);
+};
+void f2() { new X; }