// RUN: %clang_cc1 -std=c++11 %s -verify -triple x86_64-linux-gnu namespace std { typedef decltype(nullptr) nullptr_t; } template struct IP { // expected-note 5 {{template parameter is declared here}} IP *ip2; }; template struct IR {}; constexpr std::nullptr_t get_nullptr() { return nullptr; } constexpr std::nullptr_t np = nullptr; std::nullptr_t nonconst_np; // expected-note{{declared here}} thread_local int tl; // expected-note {{refers 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 *'}} IP ip2; IP ip3; IP<(int*)0> ip4; IP ip5; IP 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 *'}} IP<&tl> ip7; // expected-error{{non-type template argument of type 'int *' is not a constant expression}} IR ir1; // expected-error{{non-type template argument refers to thread-local object}} struct X { }; template struct PM { // expected-note 2 {{template parameter is declared here}} PM *pm2; }; PM<0> pm0; // expected-error{{null non-type template argument must be cast to template parameter type 'int X::*'}} PM<(0)> pm1; // expected-error{{null non-type template argument must be cast to template parameter type 'int X::*'}} PM pm2; PM pm3; PM<(int X::*)0> pm4; PM pm5; template struct PMF { // expected-note 2 {{template parameter is declared here}} PMF *pmf2; }; PMF<0> pmf0; // expected-error{{null non-type template argument must be cast to template parameter type 'int (X::*)(int)'}} PMF<(0)> pmf1; // expected-error{{null non-type template argument must be cast to template parameter type 'int (X::*)(int)'}} PMF pmf2; PMF pmf3; PMF<(int (X::*)(int))0> pmf4; PMF pmf5; template struct NP { // expected-note 2{{template parameter is declared here}} NP *np2; }; NP np1; NP np2; NP np3; NP<0> np4; // expected-error{{null non-type template argument must be cast to template parameter type 'std::nullptr_t' (aka 'nullptr_t')}} constexpr int i = 7; NP np5; // expected-error{{non-type template argument of type 'const int' cannot be converted to a value of type 'std::nullptr_t'}}