]> granicus.if.org Git - clang/commitdiff
Fix test and handle IK_LiteralOperatorId in a few more places.
authorSean Hunt <rideau3@gmail.com>
Sat, 28 Nov 2009 08:58:14 +0000 (08:58 +0000)
committerSean Hunt <rideau3@gmail.com>
Sat, 28 Nov 2009 08:58:14 +0000 (08:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90030 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExprCXX.cpp
lib/Sema/SemaTemplate.cpp
test/Parser/cxx0x-literal-operators.cpp

index 6aca1cbbcc46761aa77dc37ff8f941878214ba70..1dc5e68717e34c88eaaf0cbefd0ac0ecee48dec2 100644 (file)
@@ -124,7 +124,8 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
           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 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
   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 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
     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 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
     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, 
index 59ff2947c14c947a1a6c6cff35a7924ce16d4128..2e4eed8b2860f30cbb05559cb5139547a923b3b0 100644 (file)
@@ -130,6 +130,10 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
                                               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 @@ Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
   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;
   }
index b01cf06edbdc4a54dfde5433e741dc353cea16f0..6930adbe3720291c82974b75614fb38f26fdee03 100644 (file)
@@ -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}}