[cfe-commits] r67480 - in /cfe/trunk/lib/Sema: SemaDeclCXX.cpp SemaType.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sun Mar 22 14:28:55 PDT 2009


Author: cornedbee
Date: Sun Mar 22 16:28:55 2009
New Revision: 67480

URL: http://llvm.org/viewvc/llvm-project?rev=67480&view=rev
Log:
Fix build from r67476 and address the easy part of Doug's comments on rvalue refs.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaType.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Mar 22 16:28:55 2009
@@ -711,7 +711,10 @@
   class VISIBILITY_HIDDEN PureVirtualMethodCollector {
     ASTContext &Context;
 
+  public:
     typedef llvm::SmallVector<const CXXMethodDecl*, 8> MethodList;
+
+  private:
     MethodList Methods;
     
     void Collect(const CXXRecordDecl* RD, MethodList& Methods);
@@ -1865,7 +1868,6 @@
     BindsDirectly = true;
 
     // Rvalue references cannot bind to lvalues (N2812).
-    // FIXME: This part of rvalue references is still in flux. Revisit later.
     if (isRValRef) {
       if (!ICS)
         Diag(Init->getSourceRange().getBegin(), diag::err_lvalue_to_rvalue_ref)
@@ -1909,8 +1911,6 @@
   //          92) (this conversion is selected by enumerating the
   //          applicable conversion functions (13.3.1.6) and choosing
   //          the best one through overload resolution (13.3)),
-  // FIXME: Without standard language for N2812, the rvalue reference treatment
-  // here is pretty much a guess.
   if (!isRValRef && !SuppressUserConversions && T2->isRecordType()) {
     // FIXME: Look for conversions in base classes!
     CXXRecordDecl *T2RecordDecl 
@@ -1923,10 +1923,9 @@
            = Conversions->function_begin();
          Func != Conversions->function_end(); ++Func) {
       CXXConversionDecl *Conv = cast<CXXConversionDecl>(*Func);
-      
+
       // If the conversion function doesn't return a reference type,
       // it can't be considered for this conversion.
-      // FIXME: This will change when we support rvalue references.
       if (Conv->getConversionType()->isLValueReferenceType() &&
           (AllowExplicit || !Conv->isExplicit()))
         AddConversionCandidate(Conv, Init, DeclType, CandidateSet);

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sun Mar 22 16:28:55 2009
@@ -323,10 +323,13 @@
                                   SourceLocation Loc, DeclarationName Entity) {
   if (LValueRef) {
     if (const RValueReferenceType *R = T->getAsRValueReferenceType()) {
-      // FIXME: Find the C++0x reference for reference collapsing.
-      // In reference collapsing, lvalue refs win over rvalue refs.
+      // C++0x [dcl.typedef]p9: If a typedef TD names a type that is a
+      //   reference to a type T, and attempt to create the type "lvalue
+      //   reference to cv TD" creates the type "lvalue reference to T".
+      // We use the qualifiers (restrict or none) of the original reference,
+      // not the new ones. This is consistent with GCC.
       return Context.getLValueReferenceType(R->getPointeeType()).
-               getQualifiedType(Quals);
+               getQualifiedType(T.getCVRQualifiers());
     }
   }
   if (T->isReferenceType()) {





More information about the cfe-commits mailing list