[PATCH] D22476: [AST] Make MemberExpr non-dependent according to core issue 224

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 14:03:58 PDT 2016


mgehre created this revision.
mgehre added reviewers: klimek, aaron.ballman, rsmith.
mgehre added a subscriber: cfe-commits.

A MemberExpr is non-dependent if
1) it is a member of the current instantiation
2) the member is non-dependent

We check 1) by asserting that the base of the
MemberExpr is a CXXThisExpr. In addition,
the parent of the member needs to be the current
class or a base of it. (It can happen that the member
decl resolves to a member of an outer class, and later
on Sema prints an error about it. In this case, we keep
it type-dependent, and the error will only appear if it is
ODR-used.)

This changes makes clang reject certain source code that it previously accepted,
namely invalid use of members in functions that are never specialized
or ODR-used. The changes to the tests show examples of this.

https://reviews.llvm.org/D22476

Files:
  lib/AST/Expr.cpp
  lib/Sema/SemaOverload.cpp
  test/Analysis/stack-addr-ps.cpp
  test/CXX/class.access/class.access.dcl/p1.cpp
  test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
  test/CXX/drs/dr3xx.cpp
  test/SemaTemplate/dependent-names.cpp
  test/SemaTemplate/enum-argument.cpp
  test/SemaTemplate/member-access-expr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22476.64379.patch
Type: text/x-patch
Size: 6263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160718/bcae479b/attachment-0001.bin>


More information about the cfe-commits mailing list