summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.unary
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/expr/expr.unary')
-rw-r--r--clang/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp b/clang/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
index 6a59e3d7ae5..77d786568bd 100644
--- a/clang/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
+++ b/clang/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
@@ -18,3 +18,11 @@ void test(A *a) {
x = sizeof(a->bitX = 3); // expected-error {{invalid application of 'sizeof' to bit-field}}
x = sizeof(a->bitY += 3); // expected-error {{invalid application of 'sizeof' to bit-field}}
}
+
+void test2() {
+ int x;
+ x = sizeof(void); // expected-error {{invalid application of 'sizeof' to an incomplete type 'void'}}
+ x = sizeof(int()); // expected-error {{invalid application of 'sizeof' to a function type}}
+ x = sizeof(test2()); // expected-error {{invalid application of 'sizeof' to an incomplete type 'void'}}
+ x = sizeof(test2); // expected-error {{invalid application of 'sizeof' to a function type}}
+}
OpenPOWER on IntegriCloud