diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2013-08-13 22:26:42 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2013-08-13 22:26:42 +0000 |
| commit | 4e28b26589016fa9b8f94224af7b7c108447017f (patch) | |
| tree | cb4513d8eb51ad7ad4d7ec1ab27003c1f76c79a5 /clang/test/CXX/expr/expr.unary | |
| parent | 76ff1d915c9c42823a3f2b08ff936cf7a48933c5 (diff) | |
| download | bcm5719-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.cpp | 8 |
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}} +} |

