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

            Bug ID: 125555
           Summary: error: mangling of ... conflicts with a previous
                    mangle [import std]
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leander.schulten at tetys dot de
  Target Milestone: ---

See https://godbolt.org/z/T63hc98ac 

I have testModule.cpp:
```c++
export module testModule;
import std;
export {
    struct TestTrigger
    {
        TestTrigger()
        {
            trigger_bug<int>();
        }
        template <typename Tag>
        void trigger_bug()
        {
            std::vector<int> vec = {};
            auto it1 = vec.begin();
            auto it2 = vec.end();

            // Step 4: Force the compiler to instantiate the constrained
            // three-way comparison operator inside __normal_iterator
            auto result = it1 <=> it2;
        }
    };
}
```
and 
consumer.cpp:
```c++
export module test;

import testModule;
import std;
void test() {
    TestTrigger trigger;
    trigger.trigger_bug<int>();
    std::vector<int> vec = {};
    auto it1 = vec.begin();
    auto it2 = vec.end();

    // Step 4: Force the compiler to instantiate the constrained
    // three-way comparison operator inside __normal_iterator
    auto result = it1 <=> it2;
}
```
which results in a mangling error:
...
[9/10] /opt/compiler-explorer/gcc-snapshot/bin/g++   -fdiagnostics-color=always
-O2 -g -DNDEBUG -std=gnu++23 -MD -MT CMakeFiles/test_target.dir/consumer.cpp.o
-MF CMakeFiles/test_target.dir/consumer.cpp.o.d -fmodules-ts
-fmodule-mapper=CMakeFiles/test_target.dir/consumer.cpp.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o CMakeFiles/test_target.dir/consumer.cpp.o -c
/app/consumer.cpp
FAILED: CMakeFiles/test_target.dir/consumer.cpp.o
CMakeFiles/test_target.dir/test.gcm 
/opt/compiler-explorer/gcc-snapshot/bin/g++   -fdiagnostics-color=always -O2 -g
-DNDEBUG -std=gnu++23 -MD -MT CMakeFiles/test_target.dir/consumer.cpp.o -MF
CMakeFiles/test_target.dir/consumer.cpp.o.d -fmodules-ts
-fmodule-mapper=CMakeFiles/test_target.dir/consumer.cpp.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o CMakeFiles/test_target.dir/consumer.cpp.o -c
/app/consumer.cpp
In file included from
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/bits/stl_algobase.h:66,
                 from
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/algorithm:62,
                 from
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/x86_64-linux-gnu/bits/stdc++.h:51,
                 from
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/bits/std.cc:26,
of module std, imported at /app/consumer.cpp:4:
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/bits/stl_iterator.h:1204:9:
error: mangling of 'constexpr std::__detail::__synth3way_t<_Iterator, _Iter>
__gnu_cxx::operator<=>(const __normal_iterator<_Iterator, _Container>&, const
__normal_iterator<_Iter, _Container>&) requires
requires{std::__detail::__synth3way(__gnu_cxx::operator<=>::__lhs->__gnu_cxx::__normal_iterator<_Iterator,
_Container>::base()(), __gnu_cxx::operator<=>::__rhs->base());} [with _Iter =
int*; _Iterator = int*; _Container = std::vector<int>]' as
'_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEFssIS1_EEDTclL_ZNSt8__detail11__synth3wayEEclL_ZSt7declvalIRS1_EDTcl9__declvalIT_ELi0EEEvEEcl7declvalIRSA_EEEERKS5_RKNS0_ISA_S4_EEQrqXclL_ZNS7_11__synth3wayEEcldtfL0p_L_ZNKS0_ISA_T0_E4baseEvEEcldtfL0p0_4baseEEE'
conflicts with a previous mangle
 1204 |         operator<=>(const __normal_iterator& __lhs,
      |         ^~~~~~~~
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/bits/stl_iterator.h:1204:9:
note: previous mangling 'constexpr std::__detail::__synth3way_t<_Iterator,
_Iter> __gnu_cxx::operator<=>(const __normal_iterator<_Iterator, _Container>&,
const __normal_iterator<_Iter, _Container>&) requires
requires{std::__detail::__synth3way(__gnu_cxx::operator<=>::__lhs->__gnu_cxx::__normal_iterator<_Iterator,
_Container>::base()(), __gnu_cxx::operator<=>::__rhs->base());} [with _Iter =
int*; _Iterator = int*; _Container = std::vector<int>]'
/cefs/b3/b3b72314e12372419032a943_gcc-trunk-20260601/include/c++/17.0.0/bits/stl_iterator.h:1204:9:
note: a later '-fabi-version=' (or =0) avoids this error with a change in
mangling
ninja: build stopped: subcommand failed.
  • [Bug c++/125555] New: error:... leander.schulten at tetys dot de via Gcc-bugs

Reply via email to