diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-10 19:03:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-10 19:03:30 +0000 |
commit | 50fadd19497f5fa6d8737786ba74af8354d28349 (patch) | |
tree | 1b67547ee3742f83df228931e10cb1a542a7bbcb /test/CXX | |
parent | b2561c7545eae5f18c9347a0704d4ca6954b2294 (diff) |
Improve diagnostics in C++11 when a non-type template argument for a
non-type template parameter of pointer type is not a constant expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp b/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp index f31c3daf15..59ce8b68b7 100644 --- a/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp +++ b/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp @@ -12,7 +12,7 @@ constexpr std::nullptr_t get_nullptr() { return nullptr; } constexpr std::nullptr_t np = nullptr; -std::nullptr_t nonconst_np; +std::nullptr_t nonconst_np; // expected-note{{declared here}} IP<0> ip0; // expected-error{{null non-type template argument must be cast to template parameter type 'int *'}} IP<(0)> ip1; // expected-error{{null non-type template argument must be cast to template parameter type 'int *'}} @@ -20,7 +20,8 @@ IP<nullptr> ip2; IP<get_nullptr()> ip3; IP<(int*)0> ip4; IP<np> ip5; -IP<nonconst_np> ip5; // expected-error{{non-type template argument for template parameter of pointer type 'int *' must have its address taken}} +IP<nonconst_np> ip5; // expected-error{{non-type template argument of type 'std::nullptr_t' (aka 'nullptr_t') is not a constant expression}} \ +// expected-note{{read of non-constexpr variable 'nonconst_np' is not allowed in a constant expression}} IP<(float*)0> ip6; // expected-error{{null non-type template argument of type 'float *' does not match template parameter of type 'int *'}} struct X { }; |