summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.unary
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-08-13 22:26:42 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-08-13 22:26:42 +0000
commit4e28b26589016fa9b8f94224af7b7c108447017f (patch)
treecb4513d8eb51ad7ad4d7ec1ab27003c1f76c79a5 /clang/test/CXX/expr/expr.unary
parent76ff1d915c9c42823a3f2b08ff936cf7a48933c5 (diff)
downloadbcm5719-llvm-4e28b26589016fa9b8f94224af7b7c108447017f.tar.gz
bcm5719-llvm-4e28b26589016fa9b8f94224af7b7c108447017f.zip
sizeof(void) etc. should be a hard error in C++.
PR16872. llvm-svn: 188324
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