aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/StmtPrinter.cpp2
-rw-r--r--test/SemaCXX/ast-print.cpp18
2 files changed, 13 insertions, 7 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index d7392af808..5d3b83a150 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -936,7 +936,7 @@ void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
OS << Node->getAccessor().getName();
}
void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
- OS << "(" << Node->getType().getAsString(Policy) << ")";
+ OS << "(" << Node->getTypeAsWritten().getAsString(Policy) << ")";
PrintExpr(Node->getSubExpr());
}
void StmtPrinter::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
diff --git a/test/SemaCXX/ast-print.cpp b/test/SemaCXX/ast-print.cpp
index 15fdabfe32..5e89c8b548 100644
--- a/test/SemaCXX/ast-print.cpp
+++ b/test/SemaCXX/ast-print.cpp
@@ -13,8 +13,7 @@ struct Reference
MyClass* operator ->() { return object; }
};
-int main()
-{
+void test1() {
Reference r;
(r->method());
}
@@ -23,7 +22,7 @@ int main()
// CHECK: while (int a = 1)
// CHECK: switch (int a = 1)
-void f()
+void test2()
{
if (int a = 1) { }
while (int a = 1) { }
@@ -32,7 +31,7 @@ void f()
// CHECK: new (1) int;
void *operator new (typeof(sizeof(1)), int, int = 2);
-void f2() {
+void test3() {
new (1) int;
}
@@ -40,9 +39,16 @@ void f2() {
struct X {
void *operator new (typeof(sizeof(1)), int = 2);
};
-void f2() { new X; }
+void test4() { new X; }
// CHECK: for (int i = 2097, j = 42; false;)
-void forInit() {
+void test5() {
for (int i = 2097, j = 42; false;) {}
}
+
+// CHECK: test6fn((int &)y);
+void test6fn(int& x);
+void test6() {
+ unsigned int y = 0;
+ test6fn((int&)y);
+}