From 98a0a49fbfdfc1933e1f40cce630d7f4bccf5afa Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 14 Feb 2012 21:38:30 +0000 Subject: 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 --- clang/test/SemaCXX/nullptr.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/test/SemaCXX/nullptr.cpp') 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 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}} + +} -- cgit v1.2.3