TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24504 22
Possible GCC reflection error

Playing with GCC I got a situation like this:

#include <algorithm>
#include <array>
#include <print>
#include <meta>


consteval auto Name(const int integer){
    return std::meta::displaystringof(^^integer);
}
consteval auto Name(const std::meta::info meta){
    return std::meta::displaystringof(meta);
}
// <source>:21:28: error: call to consteval function 'Name(^^int)' is not a constant expression
//    17 |     std::println("{}", Name(^^int));
//       |                        ~~~~^~~~~~~
// But removing const fix it!! (works in Clang P2996)




int main(){
    std::println("{}", Name(3));
    std::println("{}", Name(^^int));


    return 0;
}

I think that this is not the expected behaviour, but is it a known bug to be patched?

https://redd.it/1po9oz2
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 9, 2026std::variant, operator== and pattern matching I was thinking, wouldn't adding equality com…
  2. Oct 8, 2026Profiles for simplicity and guarantees - Bjarne Stroustrup - CppCon 2026 https://youtu.be/…
  3. Oct 8, 2026How to Fix autoconf-style Configuration Probing https://build2.org/blog/fix-autoconf.xhtml…
  4. Oct 8, 2026owl – a header-only C++23 HTTP framework where route patterns and handler extractors are c…
  5. Oct 8, 2026Removed by Reddit Removed by Reddit on account of violating the [content policy. ] https:/…
  6. Oct 8, 2026Is there a way to search across all P and N papers throughout standardization history? It…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →