[Bug c++/71420] "‘type’ is not a class type" error for address-of operator overloaded for enum type

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 12 01:13:47 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=80299     |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think there are two issues here causing this to be a problem.

The major problem is recorded in PR 101869.

Also a workaround is put parentheses around the three enum values like:

template<typename D, typename T = decltype(&(D::unk))>
...
        static constexpr auto add = &(D::add);
        static constexpr auto sub = &(D::sub);


More information about the Gcc-bugs mailing list