1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2 3 namespace PR15360 { 4 template<typename R, typename U, R F> 5 U f() { return &F; } // expected-error{{cannot take the address of an rvalue of type 'int (*)(int)'}} expected-error{{cannot take the address of an rvalue of type 'int *'}} 6 void test() { 7 f<int(int), int(*)(int), nullptr>(); // expected-note{{in instantiation of}} 8 f<int[3], int*, nullptr>(); // expected-note{{in instantiation of}} 9 } 10 } 11 12 namespace CanonicalNullptr { 13 template<typename T> struct get { typedef T type; }; 14 struct X {}; 15 template<typename T, typename get<T *>::type P = nullptr> struct A {}; 16 template<typename T, typename get<decltype((T(), nullptr))>::type P = nullptr> struct B {}; 17 template<typename T, typename get<T X::*>::type P = nullptr> struct C {}; 18 19 template<typename T> A<T> MakeA(); 20 template<typename T> B<T> MakeB(); 21 template<typename T> C<T> MakeC(); 22 A<int> a = MakeA<int>(); 23 B<int> b = MakeB<int>(); 24 C<int> c = MakeC<int>(); 25 } 26