diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2014-12-11 19:36:24 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-11 19:36:24 +0000 |
| commit | 27db35878dccd6dd5e62130f644bf01939f56716 (patch) | |
| tree | 7b310f00f4bafae67049ac67c3ceac85e4a2e471 /clang/test | |
| parent | 2521f36e5ddcadf8dc4bd9803c4ac74fc276f046 (diff) | |
| download | bcm5719-llvm-27db35878dccd6dd5e62130f644bf01939f56716.tar.gz bcm5719-llvm-27db35878dccd6dd5e62130f644bf01939f56716.zip | |
AST: Incomplete types might be zero sized
Comparing the address of an object with an incomplete type might return
true with a 'distinct' object if the former has a size of zero.
However, such an object should compare unequal with null.
llvm-svn: 224040
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index 9a650087f9a..5fb6f2c5f81 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1960,4 +1960,12 @@ namespace PR21786 { extern void (*start[])(); extern void (*end[])(); static_assert(&start != &end, ""); // expected-error {{constant expression}} + + struct Foo; + struct Bar { + static const Foo x; + static const Foo y; + }; + static_assert(&Bar::x != nullptr, ""); + static_assert(&Bar::x != &Bar::y, ""); // expected-error {{constant expression}} } |

