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

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Peter Dimov from comment #5)
> Another:
> 
> ```
> struct X
> {
>     int v;
> };
> 
> template<int I> struct Y: X
> {
> };
> 
> void f( int v );
> 
> void h( unsigned ix, void* p )
> {
>     switch( ix )
>     {
>         case 0: f( ((Y<0>*)p)->v ); break;
>         case 1: f( ((Y<1>*)p)->v ); break;
>         case 2: f( ((Y<2>*)p)->v ); break;
>         case 3: f( ((Y<3>*)p)->v ); break;
>         case 4: f( ((Y<4>*)p)->v ); break;
>         case 5: f( ((Y<5>*)p)->v ); break;
>         default: __builtin_unreachable();
>     }
> }
> ```
> 
> ```
> h(unsigned int, void*):
>   mov edi, edi
>   jmp [QWORD PTR .L4[0+rdi*8]]
> .L4:
>   .quad .L3
>   .quad .L3
>   .quad .L3
>   .quad .L3
>   .quad .L3
>   .quad .L3
> .L3:
>   mov edi, DWORD PTR [rsi]
>   jmp f(int)
> ```
> 
> https://godbolt.org/z/pGVx6W
> 
> This however demonstrates a different problem, so it may need to go into a
> separate bug.

I'm not sure here Y<N> are different types here and member access based on the
type
is distinct.

Reply via email to