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

--- Comment #2 from grbrown <grbrown93 at sbcglobal dot net> ---
(In reply to Andrew Pinski from comment #1)
> Note clang also rejects this code for the same reason as GCC.
> 
> Here is a reduced version which shows the difference between ICC/MSVC and
> GCC/clang:
> ```
> struct A
> {
>   int data;
> };
> struct B : A{};
> 
> struct Container1
> {
>   template<typename DataType>
>   void print(DataType B::*member);
> };
> 
> void setup1(Container1& container)
> {
>   container.print(&A::data); // BROKEN IN GCC!
> }
> ```
> 
> Basically MSVC/ICC can cast between `float B::*` and `float A::*` ...

>From my tests though, removing the 'template<DataType>' will allow it to work,
so I don't know if you're explanation is entirely correct.

Reply via email to