[PATCH] D24969: [Sema] Use the instantiated name of destructors in FindInstantiatedDecl and RebuildMemberExpr

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 12:48:29 PST 2016


ahatanak added inline comments.


================
Comment at: lib/Sema/TreeTransform.h:8766-8767
   NamedDecl *FirstQualifierInScope = nullptr;
+  DeclarationNameInfo MemberNameInfo =
+      getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
 
----------------
rsmith wrote:
> Likewise here, you should return `ExprError()` if the transformed name is null (please also add an assert that the name is not null before the transform, as in that case a null transformed name would not indicate an error has been diagnosed).
I discovered that the name can be null when the member expression is a member of an anonymous union and therefore an assert would cause a few regression tests to fail. For example, the following code would assert:


```
struct T0 {
  union {
    void *m0;
  };
};
template <typename T>
struct T1 : public T0 {
  void f0() {
    m0 = 0;
  }
};

struct A : public T0 { };

void f1(T1<A> *S) { S->f0(); }
```


https://reviews.llvm.org/D24969





More information about the cfe-commits mailing list