https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123614

            Bug ID: 123614
           Summary: [reflection] bogus is not a constant expression error
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

```
#include <meta>

consteval auto Name(const std::meta::info meta){
    return std::meta::display_string_of(meta);
}

int main() {
  auto sv = std::define_static_string(Name(^^int));
}
```

results in

rep.C: In function ‘int main()’:
rep.C:10:38: error: call to consteval function
‘std::define_static_string<basic_string_view<char> >(Name(^^int))’ is not a
constant expression
   10 |   auto sv = std::define_static_string(Name(^^int));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

but it works without the "const".

Reply via email to