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

            Bug ID: 124957
           Summary: [modules] mismatching abi tags for ‘...’ with no tags
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel at laverdet dot com
  Target Milestone: ---

// partition.cc
module;
constexpr inline int n = 0;
export module mod:partition;

struct [[gnu::abi_tag("cxx11")]] tagged {};

export struct Foo {
  tagged name;
  constexpr static auto t2 = &Foo::name;
};

// iface.cc
export module mod;
export import :partition;

// impl.cc
module mod;
import :partition;

auto f() -> Foo;

-----

Observed error in gcc 15 and gcc 16 trunk

g++ -std=c++23 -fmodules-ts -Wno-global-module -c partition.cc
g++ -std=c++23 -fmodules-ts -c iface.cc
g++ -std=c++23 -fmodules-ts -c impl.cc
In module mod:partition, imported at impl.cc:2:
partition.cc:9:39: error: mismatching abi tags for ‘Foo@mod:partition::t2’ with
no tags
    9 |                 constexpr static auto t2 = &Foo::name;
      |                                       ^~
In file included from iface.cc:2:8,
of module mod, imported at impl.cc:1:
partition.cc:9:39: note: existing declaration here with tags ‘"cxx11"’
    9 |                 constexpr static auto t2 = &Foo::name;
      |                                       ^~
impl.cc:4:13: note: during load of binding ‘::Foo@mod:partition’
    4 | auto f() -> Foo;
      |             ^~~

-----

partition.cc was reduced from this which demonstrates the issue without
vendor-specific tags.

module;
#include <string>
export module mod:partition;

export struct Foo {
  std::string name;
  constexpr static auto t2 = &Foo::name;
};

Reply via email to