[cfe-commits] r92141 - in /cfe/trunk: lib/Sema/SemaExpr.cpp lib/Sema/TreeTransform.h test/SemaTemplate/anonymous-union.cpp

Douglas Gregor dgregor at apple.com
Thu Dec 24 12:23:34 PST 2009


Author: dgregor
Date: Thu Dec 24 14:23:34 2009
New Revision: 92141

URL: http://llvm.org/viewvc/llvm-project?rev=92141&view=rev
Log:
Add test case for PR5868, and improve location information slightly for implicit "this" expressions

Added:
    cfe/trunk/test/SemaTemplate/anonymous-union.cpp   (with props)
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=92141&r1=92140&r2=92141&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Dec 24 14:23:34 2009
@@ -564,7 +564,7 @@
                == Context.getCanonicalType(ThisType)) ||
             IsDerivedFrom(ThisType, AnonFieldType)) {
           // Our base object expression is "this".
-          BaseObjectExpr = new (Context) CXXThisExpr(SourceLocation(),
+          BaseObjectExpr = new (Context) CXXThisExpr(Loc,
                                                      MD->getThisType(Context));
           BaseObjectIsPointer = true;
         }

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=92141&r1=92140&r2=92141&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Dec 24 14:23:34 2009
@@ -959,6 +959,7 @@
       Expr *BaseExpr = Base.takeAs<Expr>();
       if (getSema().PerformObjectMemberConversion(BaseExpr, Member))
         return getSema().ExprError();
+
       MemberExpr *ME =
         new (getSema().Context) MemberExpr(BaseExpr, isArrow,
                                            Member, MemberLoc,

Added: cfe/trunk/test/SemaTemplate/anonymous-union.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/anonymous-union.cpp?rev=92141&view=auto

==============================================================================
--- cfe/trunk/test/SemaTemplate/anonymous-union.cpp (added)
+++ cfe/trunk/test/SemaTemplate/anonymous-union.cpp Thu Dec 24 14:23:34 2009
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR5868
+struct T0 {
+  int x;
+  union {
+    void *m0;
+  };
+};
+template <typename T>
+struct T1 : public T0, public T { 
+  void f0() { 
+    m0 = 0; // expected-error{{ambiguous conversion}}
+  } 
+};
+
+struct A : public T0 { };
+
+void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}}

Propchange: cfe/trunk/test/SemaTemplate/anonymous-union.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/SemaTemplate/anonymous-union.cpp

------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/SemaTemplate/anonymous-union.cpp

------------------------------------------------------------------------------
    svn:mime-type = text/plain





More information about the cfe-commits mailing list