]> granicus.if.org Git - clang/commitdiff
Template instantiation for the GNU address-of-label extension.
authorDouglas Gregor <dgregor@apple.com>
Fri, 22 May 2009 23:25:52 +0000 (23:25 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 22 May 2009 23:25:52 +0000 (23:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72301 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateExpr.cpp
test/SemaTemplate/instantiate-function-1.cpp

index f20d699815a2aadacae80782d7baa64b9fec2ea1..1e57e1b5a375607166389369e65397cd8b466f75 100644 (file)
@@ -55,7 +55,7 @@ namespace {
     OwningExprResult VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
     OwningExprResult VisitCXXConditionDeclExpr(CXXConditionDeclExpr *E);
     OwningExprResult VisitConditionalOperator(ConditionalOperator *E);
-    // FIXME: AddrLabelExpr
+    OwningExprResult VisitAddrLabelExpr(AddrLabelExpr *E);
     OwningExprResult VisitStmtExpr(StmtExpr *E);
     OwningExprResult VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
     OwningExprResult VisitShuffleVectorExpr(ShuffleVectorExpr *E);
@@ -526,6 +526,13 @@ TemplateExprInstantiator::VisitConditionalOperator(ConditionalOperator *E) {
                                     move(Cond), move(LHS), move(RHS));
 }
 
+Sema::OwningExprResult 
+TemplateExprInstantiator::VisitAddrLabelExpr(AddrLabelExpr *E) {
+  return SemaRef.ActOnAddrLabel(E->getAmpAmpLoc(),
+                                E->getLabelLoc(),
+                                E->getLabel()->getID());
+}
+
 Sema::OwningExprResult TemplateExprInstantiator::VisitStmtExpr(StmtExpr *E) {
   Sema::OwningStmtResult SubStmt 
     = SemaRef.InstantiateCompoundStmt(E->getSubStmt(), TemplateArgs, true);
index be8c0e4cbb4d8c9094dc8447d06642e888495022..5b3a6d998404263d3f9e21835dd5898662ed1a69 100644 (file)
@@ -178,6 +178,14 @@ template<typename T> struct IndirectGoto0 {
   void f(T x) {
     // FIXME: crummy error message below
     goto *x; // expected-error{{incompatible}}
+
+  prior:
+    T prior_label = &&prior;
+
+    T later_label = &&later;
+
+  later:
+    (void)(1+1);
   }
 };