[llvm-commits] [llvm] r86204 - /llvm/trunk/include/llvm/ADT/PointerUnion.h

Douglas Gregor dgregor at apple.com
Thu Nov 5 16:12:53 PST 2009


Author: dgregor
Date: Thu Nov  5 18:12:53 2009
New Revision: 86204

URL: http://llvm.org/viewvc/llvm-project?rev=86204&view=rev
Log:
Add a bunch of missing "template" keywords to disambiguate dependent template names. GCC eats this ill-formed code, Clang does not. I already filed PR5404 to improve recovery in this case

Modified:
    llvm/trunk/include/llvm/ADT/PointerUnion.h

Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=86204&r1=86203&r2=86204&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Thu Nov  5 18:12:53 2009
@@ -186,8 +186,9 @@
     int is() const {
       // Is it PT1/PT2?
       if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
-        return Val.is<InnerUnion>() && Val.get<InnerUnion>().is<T>();
-      return Val.is<T>();
+        return Val.template is<InnerUnion>() && 
+               Val.template get<InnerUnion>().template is<T>();
+      return Val.template is<T>();
     }
     
     /// get<T>() - Return the value of the specified pointer type. If the
@@ -197,9 +198,9 @@
       assert(is<T>() && "Invalid accessor called");
       // Is it PT1/PT2?
       if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
-        return Val.get<InnerUnion>().get<T>();
+        return Val.template get<InnerUnion>().template get<T>();
       
-      return Val.get<T>();
+      return Val.template get<T>();
     }
     
     /// dyn_cast<T>() - If the current value is of the specified pointer type,
@@ -291,8 +292,10 @@
     int is() const {
       // Is it PT1/PT2?
       if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
-        return Val.is<InnerUnion1>() && Val.get<InnerUnion1>().is<T>();
-      return Val.is<InnerUnion2>() && Val.get<InnerUnion2>().is<T>();
+        return Val.template is<InnerUnion1>() && 
+               Val.template get<InnerUnion1>().template is<T>();
+      return Val.template is<InnerUnion2>() && 
+             Val.template get<InnerUnion2>().template is<T>();
     }
     
     /// get<T>() - Return the value of the specified pointer type. If the
@@ -302,9 +305,9 @@
       assert(is<T>() && "Invalid accessor called");
       // Is it PT1/PT2?
       if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1)
-        return Val.get<InnerUnion1>().get<T>();
+        return Val.template get<InnerUnion1>().template get<T>();
       
-      return Val.get<InnerUnion2>().get<T>();
+      return Val.template get<InnerUnion2>().template get<T>();
     }
     
     /// dyn_cast<T>() - If the current value is of the specified pointer type,





More information about the llvm-commits mailing list