[PATCH] D45411: [Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 7 22:54:15 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC329519: [Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple… (authored by EricWF, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D45411

Files:
  lib/Sema/SemaExprMember.cpp
  test/SemaCXX/PR35832.cpp


Index: test/SemaCXX/PR35832.cpp
===================================================================
--- test/SemaCXX/PR35832.cpp
+++ test/SemaCXX/PR35832.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+class B {
+public:
+ int i;
+ struct {  struct { union { int j; }; };  };
+};
+
+class X : public B { };
+class Y : public B { };
+
+class Z : public X, Y {
+public:
+ int a() { return X::i; }
+ int b() { return X::j; }
+ int c() { return this->X::j; }
+};
Index: lib/Sema/SemaExprMember.cpp
===================================================================
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -848,7 +848,7 @@
     // Build the first member access in the chain with full information.
     result =
         BuildFieldReferenceExpr(result, baseObjectIsPointer, SourceLocation(),
-                                EmptySS, field, foundDecl, memberNameInfo)
+                                SS, field, foundDecl, memberNameInfo)
             .get();
     if (!result)
       return ExprError();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45411.141525.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180408/638f0df4/attachment.bin>


More information about the cfe-commits mailing list