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

            Bug ID: 124781
           Summary: [modules] Exported IIFE has error: exporting
                    declaration ‘...’ declared in unnamed namespace
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel at laverdet dot com
  Target Milestone: ---

Minimal-ish repro:


module;
#include <type_traits>
export module foo;

template <auto Type>
using type_t = decltype(Type)::type;

export using xx = type_t<[]() consteval -> auto {
        using yy = int;
        return std::type_identity<int>{};
}()>;



root[15:33:29] [/workspace] $ /root/gcc-16/bin/g++ -std=c++26 -Wall -fmodules
-c a.cc
a.cc: In lambda function:
a.cc:9:15: error: exporting declaration ‘using yy = int’ declared in unnamed
namespace
    9 |         using yy = int;
      |               ^~


Commenting out the nested `using yy` declaration (which is not exported) fixes
it. Assigning the function to a temporary also fixes it.

Reply via email to