File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -560,3 +560,19 @@ void foo() {
560560 S s;
561561}
562562} // namespace GH118000
563+
564+ namespace GH119046 {
565+
566+ template <typename Cls> constexpr auto tfn (int ) {
567+ return (unsigned long long )(&Cls::sfn);
568+ // expected-note@-1 {{'tfn<GH119046::S>' is an immediate function because its body evaluates the address of a consteval function 'sfn'}}
569+ };
570+ struct S { static consteval void sfn () {} };
571+
572+ int f () {
573+ int a = 0 ; // expected-note{{declared here}}
574+ return tfn<S>(a);
575+ // expected-error@-1 {{call to immediate function 'GH119046::tfn<GH119046::S>' is not a constant expression}}
576+ // expected-note@-2 {{read of non-const variable 'a' is not allowed in a constant expression}}
577+ }
578+ }
You can’t perform that action at this time.
0 commit comments