]> granicus.if.org Git - clang/commit
Look through using decls when classifying implicit member access
authorReid Kleckner <rnk@google.com>
Tue, 20 Oct 2015 18:12:08 +0000 (18:12 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 20 Oct 2015 18:12:08 +0000 (18:12 +0000)
commit921c7cf4a8ba1ee52179bee429ee4c3e8cc5b251
tree32d76683a35e1b2b0e772755c5fe5182de93b749
parent5fd2cdb71e211c0a8ea37d64f3c995ae50a407f6
Look through using decls when classifying implicit member access

Clang will now accept this valid C++11 code:
  struct A { int field; };
  struct B : A {
    using A::field;
    enum { TheSize = sizeof(field) };
  };

Previously we would classify the 'field' reference as something other
than a field, and then forget to apply the C++11 rule to allow
non-static data member references in unevaluated contexts.

This usually arises in class templates that want to reference fields of
a dependent base in an unevaluated context outside of an instance
method. Such contexts do not allow references to 'this', so the only way
to access the field is with a using decl and an implicit member
reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250839 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaExprMember.cpp
test/SemaCXX/using-decl-1.cpp