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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-12-01
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |6.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
I tend to agree that this is valid (A::i is a valid id-expression in an
unevaluated context), even though my somewhat dated version of Clang (3.8.0,
trunk 251144, from 2015-10-23) rejects the code with the same error as GCC (see
below).  AFAICT, this was made valid for sizeof via N2253, and the changes
there extend to the typeid expression as well:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html

$ cat z.cpp && /build/llvm-trunk/bin/clang++ -S -Wall -Wextra -o /dev/null
z.cpp 
namespace std {
struct type_info {
    virtual ~type_info () { }
};
}

struct A { int i; };

int main()
{
    typeid (A::i);
}

z.cpp:11:16: error: invalid use of non-static data member 'i'
    typeid (A::i);
            ~~~^
1 error generated.

Reply via email to