================ @@ -60,3 +61,98 @@ void f3() { f2<int*>(0); f2<int>(0); // expected-error {{no matching function for call to 'f2'}} } + +#if __cplusplus >= 202002L +namespace GH138657 { +template <auto V> // #gh138657-template-head +class meta {}; +template<int N> +class meta<N()> {}; // expected-error {{called object type 'int' is not a function or function point}} + +template<int N[1]> +class meta<N()> {}; // expected-error {{called object type 'int *' is not a function or function point}} + +template<char* N> +class meta<N()> {}; // expected-error {{called object type 'char *' is not a function or function point}} + +struct S {}; +template<S> +class meta<S()> {}; // expected-error {{template argument for non-type template parameter is treated as function type 'S ()'}} + // expected-note@#gh138657-template-head {{template parameter is declared here}} + +} + +namespace GH115725 { +template<auto ...> struct X {}; +template<typename T, typename ...Ts> struct A { + template<Ts ...Ns, T *...Ps> + A(X<0(Ps)...>, Ts (*...qs)[Ns]); + // expected-error@-1{{called object type 'int' is not a function or function pointer}} + +}; +} + +namespace GH68852 { +template <auto v> +struct constexpr_value { + template <class... Ts> + constexpr constexpr_value<v(Ts::value...)> call(Ts...) { + //expected-error@-1 {{called object type 'int' is not a function or function pointer}} + return {}; + } +}; + +template <auto v> constexpr static inline auto c_ = constexpr_value<v>{}; +// expected-note@-1 {{in instantiation of template}} +auto k = c_<1>; // expected-note {{in instantiation of variable}} + +} + +namespace GH138731 { ---------------- cor3ntin wrote:
There is a bunch of C++17 features in there (inline variables) - it doesn't really matter here, but I did change the test to run in c++17 mode. Thanks https://github.com/llvm/llvm-project/pull/139246 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits