[cfe-commits] r62345 - in /cfe/trunk: include/clang/AST/Decl.h lib/Sema/SemaExprCXX.cpp test/SemaCXX/enum.cpp test/SemaCXX/member-name-lookup.cpp
Douglas Gregor
dgregor at apple.com
Fri Jan 16 11:38:24 PST 2009
Author: dgregor
Date: Fri Jan 16 13:38:23 2009
New Revision: 62345
URL: http://llvm.org/viewvc/llvm-project?rev=62345&view=rev
Log:
Fix <rdar://problem/6502934>. We were creating an ImplicitCastExpr
with reference type (it should be an lvalue with non-reference type).
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/enum.cpp
cfe/trunk/test/SemaCXX/member-name-lookup.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=62345&r1=62344&r2=62345&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Jan 16 13:38:23 2009
@@ -1076,7 +1076,8 @@
/// If so, this cannot be contained in arrays or other structs as a member.
bool HasFlexibleArrayMember : 1;
- ///
+ /// AnonymousStructOrUnion - Whether this is the type of an
+ /// anonymous struct or union.
bool AnonymousStructOrUnion : 1;
protected:
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=62345&r1=62344&r2=62345&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jan 16 13:38:23 2009
@@ -764,7 +764,8 @@
if (SCS.CopyConstructor) {
// FIXME: Create a temporary object by calling the copy
// constructor.
- ImpCastExprToType(From, ToType);
+ ImpCastExprToType(From, ToType.getNonReferenceType(),
+ ToType->isReferenceType());
return false;
}
@@ -849,7 +850,8 @@
break;
case ICK_Qualification:
- ImpCastExprToType(From, ToType);
+ ImpCastExprToType(From, ToType.getNonReferenceType(),
+ ToType->isReferenceType());
break;
default:
Modified: cfe/trunk/test/SemaCXX/enum.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/enum.cpp?rev=62345&r1=62344&r2=62345&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/enum.cpp (original)
+++ cfe/trunk/test/SemaCXX/enum.cpp Fri Jan 16 13:38:23 2009
@@ -1,5 +1,4 @@
// RUN: clang -fsyntax-only -verify %s
-
enum E {
Val1,
Val2
@@ -12,3 +11,15 @@
E e = Val1;
float& fr = enumerator_type(Val2);
}
+
+// <rdar://problem/6502934>
+typedef enum Foo {
+ A = 0,
+ B = 1
+} Foo;
+
+
+void bar() {
+ Foo myvar = A;
+ myvar = B;
+}
Modified: cfe/trunk/test/SemaCXX/member-name-lookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-name-lookup.cpp?rev=62345&r1=62344&r2=62345&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/member-name-lookup.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-name-lookup.cpp Fri Jan 16 13:38:23 2009
@@ -59,10 +59,10 @@
f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'struct A'}}
static_f(0); // okay
- // FIXME: should work E e = D::enumerator; // okay
+ E e = enumerator; // okay
type t = 0; // okay
- // FIXME: E2 e2 = D::enumerator2; // okay
+ E2 e2 = enumerator2; // okay
E3 e3; // expected-error{{member 'E3' found in multiple base classes of different types}}
}
More information about the cfe-commits
mailing list