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

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 22 14:54:00 GMT 2016


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-06-22
                 CC|                            |msebor at gcc dot gnu.org
             Blocks|                            |12944
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.3, 5.3.0, 6.1.0, 7.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with the simplified test case below.  Both Clang 3.8 and EDG eccp
4.11 accept the code.  GCC never seems to have gotten this right (there might
already be a bug about this somewhere though I couldn't find one that matched).

$ cat t.C && gcc -S -Wall -Wextra t.C

enum E { A };

constexpr E operator & (E e)
{
  return e;
}

template<typename D, D = &D::A>
struct S { };

S<E> s;
t.C:8:26: error: ‘E’ is not a class type
 template<typename D, D = &D::A>
                          ^~
t.C:11:4: error: template argument 2 is invalid
 S<E> s;
    ^


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12944
[Bug 12944] [meta-bug] C++ name-lookup problems


More information about the Gcc-bugs mailing list