[PATCH] D61396: [hip] Fix ambiguity from `>>>` of CUDA.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 15:13:46 PDT 2019


hliao updated this revision to Diff 198545.
hliao added a comment.

Add one unrealistic case for test purpose only.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61396/new/

https://reviews.llvm.org/D61396

Files:
  clang/lib/Parse/ParseTentative.cpp
  clang/test/Parser/cuda-kernel-call-c++11.cu


Index: clang/test/Parser/cuda-kernel-call-c++11.cu
===================================================================
--- clang/test/Parser/cuda-kernel-call-c++11.cu
+++ clang/test/Parser/cuda-kernel-call-c++11.cu
@@ -3,6 +3,10 @@
 template<typename T=int> struct S {};
 template<typename> void f();
 
+template<typename T, typename... V> struct S<T(V...)> {};
+
+template<typename ...T> struct V {};
+template<typename ...T> struct V<void(T)...> {};
 
 void foo(void) {
   // In C++11 mode, all of these are expected to parse correctly, and the CUDA
@@ -21,4 +25,11 @@
 
   (void)(&f<S<S<int>>>==0);
   (void)(&f<S<S<>>>==0);
+
+  S<S<S<void()>>> s6;
+}
+
+template<typename ...T>
+void bar(T... args) {
+  S<S<V<void(T)...>>> s7;
 }
Index: clang/lib/Parse/ParseTentative.cpp
===================================================================
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -590,9 +590,11 @@
     } else if (Context == TypeIdAsTemplateArgument &&
                (Tok.isOneOf(tok::greater, tok::comma) ||
                 (getLangOpts().CPlusPlus11 &&
-                 (Tok.is(tok::greatergreater) ||
+                 (Tok.isOneOf(tok::greatergreater,
+                              tok::greatergreatergreater) ||
                   (Tok.is(tok::ellipsis) &&
                    NextToken().isOneOf(tok::greater, tok::greatergreater,
+                                       tok::greatergreatergreater,
                                        tok::comma)))))) {
       TPR = TPResult::True;
       isAmbiguous = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61396.198545.patch
Type: text/x-patch
Size: 1572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190507/935f1a61/attachment.bin>


More information about the cfe-commits mailing list