[cfe-commits] r90030 - in /cfe/trunk: lib/Parse/ParseExprCXX.cpp lib/Sema/SemaTemplate.cpp test/Parser/cxx0x-literal-operators.cpp

Sean Hunt rideau3 at gmail.com
Sat Nov 28 00:58:15 PST 2009


Author: coppro
Date: Sat Nov 28 02:58:14 2009
New Revision: 90030

URL: http://llvm.org/viewvc/llvm-project?rev=90030&view=rev
Log:
Fix test and handle IK_LiteralOperatorId in a few more places.

Modified:
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/Parser/cxx0x-literal-operators.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=90030&r1=90029&r2=90030&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sat Nov 28 02:58:14 2009
@@ -124,7 +124,8 @@
           break;
         }
         
-        if (TemplateName.getKind() != UnqualifiedId::IK_OperatorFunctionId) {
+        if (TemplateName.getKind() != UnqualifiedId::IK_OperatorFunctionId &&
+            TemplateName.getKind() != UnqualifiedId::IK_LiteralOperatorId) {
           Diag(TemplateName.getSourceRange().getBegin(),
                diag::err_id_after_template_in_nested_name_spec)
             << TemplateName.getSourceRange();
@@ -791,6 +792,7 @@
   switch (Id.getKind()) {
   case UnqualifiedId::IK_Identifier:
   case UnqualifiedId::IK_OperatorFunctionId:
+  case UnqualifiedId::IK_LiteralOperatorId:
     TNK = Actions.isTemplateName(CurScope, SS, Id, ObjectType, EnteringContext, 
                                  Template);
     break;
@@ -848,7 +850,8 @@
     return true;
   
   if (Id.getKind() == UnqualifiedId::IK_Identifier ||
-      Id.getKind() == UnqualifiedId::IK_OperatorFunctionId) {
+      Id.getKind() == UnqualifiedId::IK_OperatorFunctionId ||
+      Id.getKind() == UnqualifiedId::IK_LiteralOperatorId) {
     // Form a parsed representation of the template-id to be stored in the
     // UnqualifiedId.
     TemplateIdAnnotation *TemplateId
@@ -1167,12 +1170,13 @@
     if (ParseUnqualifiedIdOperator(SS, EnteringContext, ObjectType, Result))
       return true;
     
-    // If we have an operator-function-id and the next token is a '<', we may
-    // have a
+    // If we have an operator-function-id or a literal-operator-id and the next
+    // token is a '<', we may have a
     // 
     //   template-id:
     //     operator-function-id < template-argument-list[opt] >
-    if (Result.getKind() == UnqualifiedId::IK_OperatorFunctionId &&
+    if ((Result.getKind() == UnqualifiedId::IK_OperatorFunctionId ||
+         Result.getKind() == UnqualifiedId::IK_LiteralOperatorId) &&
         Tok.is(tok::less))
       return ParseUnqualifiedIdTemplateId(SS, 0, SourceLocation(), 
                                           EnteringContext, ObjectType, 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sat Nov 28 02:58:14 2009
@@ -130,6 +130,10 @@
                                               Name.OperatorFunctionId.Operator);
     break;
 
+  case UnqualifiedId::IK_LiteralOperatorId:
+    assert(false && "We don't support these; Parse shouldn't have allowed propagation");
+
+
   default:
     return TNK_Non_template;
   }
@@ -1686,7 +1690,10 @@
   case UnqualifiedId::IK_OperatorFunctionId:
     return TemplateTy::make(Context.getDependentTemplateName(Qualifier,
                                              Name.OperatorFunctionId.Operator));
-      
+
+  case UnqualifiedId::IK_LiteralOperatorId:
+    assert(false && "We don't support these; Parse shouldn't have allowed propagation");
+
   default:
     break;
   }

Modified: cfe/trunk/test/Parser/cxx0x-literal-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-literal-operators.cpp?rev=90030&r1=90029&r2=90030&view=diff

==============================================================================
--- cfe/trunk/test/Parser/cxx0x-literal-operators.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-literal-operators.cpp Sat Nov 28 02:58:14 2009
@@ -2,4 +2,4 @@
 
 void operator "" (); // expected-error {{expected identifier}}
 void operator "k" foo(); // expected-error {{string literal after 'operator' must be '""'}} \
-                         // expected-error {{C++0x literal operator support is currently under development}}
\ No newline at end of file
+                         // expected-error {{C++0x literal operator support is currently under development}}





More information about the cfe-commits mailing list