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

--- Comment #3 from Marcel Laverdet <marcel at laverdet dot com> ---
Thank you for the lightning-fast responses Nathaniel!

I have another one which probably shouldn't fail. This is not a regression and
also fails on gcc-15.

I would expect both exports to be `int`

-----

export module test;

template <auto Value>
using decltype_t = decltype(Value);

constexpr auto fn = [] { return 0; };

// this is fine
export template <class>
using xx = decltype_t<fn()>;

// this is not
export template <class>
using yy = decltype_t<[] { return 0; }()>;

-----

root[01:18:16] [/workspace] $ g++ -std=c++26 -Wall -fmodules -c a.cc
a.cc:4:7: error: ‘using decltype_t = decltype (<lambda>())’ exposes TU-local
entity ‘template<class> struct<lambda()>’
    4 | using decltype_t = decltype(Value);
      |       ^~~~~~~~~~
a.cc:14:24: note: ‘<lambda()>’ has no name and cannot be differentiated from
similar lambdas in other TUs
   14 | using yy = decltype_t<[] { return 0; }()>;
      |                        ^

Reply via email to