https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119762
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[15 Regression[modules] |[modules] Error when
| |loading an unused defaulted
| |function on top of a used
| |one
--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Consider:
// A.cpp
module;
struct exception_ptr {
friend bool operator==(const exception_ptr&, const exception_ptr&) =
default;
};
export module M;
export using ::exception_ptr;
// B.cpp
struct exception_ptr {
friend bool operator==(const exception_ptr&, const exception_ptr&) =
default;
};
void enqueue() {
exception_ptr e;
e == e;
}
import M;
int main() {
exception_ptr e;
e == e;
}
$ g++ -fmodules -std=c++20 -S A.cpp B.cpp:
In module M, imported at /app/main.cpp:8:
A.cpp: In function 'int main()':
A.cpp:3:13: error: conflicting global module declaration 'bool operator==(const
exception_ptr&, const exception_ptr&)'
3 | friend bool operator==(const exception_ptr&, const exception_ptr&) =
default;
| ^~~~~~~~
main.cpp:2:13: note: existing declaration 'constexpr bool operator==(const
exception_ptr&, const exception_ptr&)'
2 | friend bool operator==(const exception_ptr&, const exception_ptr&) =
default;
| ^~~~~~~~
main.cpp:10:1: note: during load of binding '::exception_ptr@M'
10 | exception_ptr e;
| ^~~~~~~~~~~~~