================
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fsyntax-only -verify
+
+using info = decltype(^^int);
+
+struct X { int a; }; // expected-note {{candidate constructor (the implicit 
copy constructor) not viable: no known conversion from 'meta::info' to 'const 
X' for 1st argument}} \
+                     // expected-note {{candidate constructor (the implicit 
move constructor) not viable: no known conversion from 'meta::info' to 'X' for 
1st argument}} \
+                     // expected-note {{candidate constructor (the implicit 
default constructor) not viable: requires 0 arguments, but 1 was provided}}
+template <typename T = X, auto ptm = &X::a>
+constexpr auto ptmOp = ((T)(^^int)).*ptm; // expected-error {{no matching 
conversion for C-style cast from 'meta::info' to 'X'}}
+constexpr auto var = ptmOp<>; // expected-note {{in instantiation of variable 
template specialization 'ptmOp' requested here}}
+
+consteval void test()
+{
+    (^^char)++; // expected-error {{cannot increment value of type 
'meta::info'}}
+    (^^short)++; // expected-error {{cannot increment value of type 
'meta::info'}}
+    (^^int)++; // expected-error {{cannot increment value of type 
'meta::info'}}
+
+    (^^char)--; // expected-error {{cannot decrement value of type 
'meta::info'}}
+    (^^short)--; // expected-error {{cannot decrement value of type 
'meta::info'}}
+    (^^int)--; // expected-error {{cannot decrement value of type 
'meta::info'}}
+}
----------------
tbaederr wrote:

What if you actually call `test`?

https://github.com/llvm/llvm-project/pull/190356
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to