diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2017-05-01 02:03:23 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2017-05-01 02:03:23 +0000 |
| commit | 499968f8a57cfe8bd44ac7370949809d77172391 (patch) | |
| tree | 30315885802e1d5e3503cea22fb86ffb3fbc3a20 /clang/test/SemaCXX/constant-expression-cxx11.cpp | |
| parent | fea2d0b8bf28a12ad54b8061fa72f996abcbe12a (diff) | |
| download | bcm5719-llvm-499968f8a57cfe8bd44ac7370949809d77172391.tar.gz bcm5719-llvm-499968f8a57cfe8bd44ac7370949809d77172391.zip | |
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.
Also fix a crash casting a derived nullptr to a virtual base.
llvm-svn: 301785
Diffstat (limited to 'clang/test/SemaCXX/constant-expression-cxx11.cpp')
| -rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index 4abbc8e9284..2a5e80adf89 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -60,6 +60,10 @@ namespace DerivedToVBaseCast { static_assert((U*)&d == w, ""); static_assert((U*)&d == x, ""); + // expected-error@+2 {{constexpr variable 'a' must be initialized by a constant expression}} + // expected-warning@+1 {{binding dereferenced null pointer to reference has undefined behavior}} + constexpr A &a = *((B*)0); // expected-note {{cannot access base class of null pointer}} + struct X {}; struct Y1 : virtual X {}; struct Y2 : X {}; |

