https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123812
Bug ID: 123812
Summary: [13/14/15/16 Regression] Sorry unimplemented: mangling
offset_ref rather than a real error message
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
// A version of fn-ptr5.C using auto instead of the direct
// pointer member to function type
struct B {
template<class T>
void f(T) { T::fail; } // { dg-error "fail" }
};
template<auto P>//void (B::*P)(int)>
struct A {
// P not called
};
template<auto P>//void (B::*P)(int)>
void wrap() {
// P not called
}
template<int>
void g() {
A<&B::f> a; // { dg-message "required from" }
wrap<&B::f>(); // { dg-message "required from" }
}
int main() {
g<0>();
}
```
The above testcase gives:
```
<source>: In instantiation of 'void wrap() [with auto P = (& B::f)]':
<source>:16:6: sorry, unimplemented: mangling offset_ref
16 | void wrap() {
| ^~~~
```
Which is totally bogus.
In GCC 12 we got:
```
<source>: In instantiation of 'struct A<(& B::f)>':
<source>:22:12: required from 'void g() [with int <anonymous> = 0]'
<source>:27:7: required from here
<source>:11:10: error: unable to deduce 'auto' from '& B::f'
11 | struct A {
| ^
<source>:11:10: note: couldn't deduce template parameter 'auto'
```
Which is correct.