diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-14 21:38:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-14 21:38:30 +0000 |
commit | 98a0a49fbfdfc1933e1f40cce630d7f4bccf5afa (patch) | |
tree | d44a4d72832911062d3f734c7a4f558f0f68ca56 /clang/test/SemaCXX/nullptr.cpp | |
parent | 89dbd3ba40d1d945c2142c2d57f908bba038659f (diff) | |
download | bcm5719-llvm-98a0a49fbfdfc1933e1f40cce630d7f4bccf5afa.tar.gz bcm5719-llvm-98a0a49fbfdfc1933e1f40cce630d7f4bccf5afa.zip |
Pending clear answer from WG21 on whether core issue 903 is intended to apply to
C++11 or just C++17, restrict the set of null pointer constants in C++11 mode
back to those which were considered null in C++98.
llvm-svn: 150510
Diffstat (limited to 'clang/test/SemaCXX/nullptr.cpp')
-rw-r--r-- | clang/test/SemaCXX/nullptr.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/nullptr.cpp b/clang/test/SemaCXX/nullptr.cpp index 6f660366e99..0e6771b57fc 100644 --- a/clang/test/SemaCXX/nullptr.cpp +++ b/clang/test/SemaCXX/nullptr.cpp @@ -161,3 +161,14 @@ namespace templates { X2<nullptr, nullptr, nullptr, nullptr> x2; } + +namespace null_pointer_constant { + +// Pending implementation of core issue 903, ensure we don't allow any of the +// C++11 constant evaluation semantics in null pointer constants. +struct S { int n; }; +constexpr int null() { return 0; } +void *p = S().n; // expected-error {{cannot initialize}} +void *q = null(); // expected-error {{cannot initialize}} + +} |