https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98163
Johannes Larsen <mail at johslarsen dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mail at johslarsen dot net
--- Comment #5 from Johannes Larsen <mail at johslarsen dot net> ---
Another similar example:
```
struct foo {
};
static constexpr const foo obj{};
template <class T, const foo& OBJ>
struct wrapper{
};
wrapper<foo, obj>
returned() {
return {};
}
template <class T, const foo& OBJ>
constexpr inline void
f(wrapper<T, OBJ>)
{
}
int main() {
f<foo, obj>({});
f(returned());
return 0;
}
```
This fails on GCC 14.1 and upwards with assembler error, and with ICE when
checking is enabled up to GCC 14.2:
```
Executor x86-64 gcc 14.2 (C++, Editor #1)
x86-64 gcc 14.2
x86-64 gcc 14.2
Compiler options for execution
-pedantic-errors -fchecking
Execution arguments...
Could not execute the program
Build failed
Compiler returned: 1
Compiler stderr
<source>:24:1: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
24 | }
| ^
_Z1fI3fooL_ZL3objEEv7wrapperIT_XT0_EE/4 (constexpr void f(wrapper<T, OBJ>)
[with T = foo; const foo& OBJ = (& obj)])
Type: function definition analyzed
Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:_Z1fI3fooL_ZL3objEEv7wrapperIT_XT0_EE one_only
previous sharing asm name: 3
References:
Referring:
Function flags: body
Called by: main/2
Calls:
_Z1fI3fooL_ZL3objEEv7wrapperIT_XT0_EE/3 (constexpr void f(wrapper<T, OBJ>)
[with T = foo; const foo& OBJ = obj])
Type: function definition analyzed
Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:_Z1fI3fooL_ZL3objEEv7wrapperIT_XT0_EE one_only
next sharing asm name: 4
References:
Referring:
Function flags: body
Called by: main/2
Calls:
<source>:24: confused by earlier errors, bailing out
```