hliao created this revision. hliao added reviewers: tra, yaxunl. Herald added a project: clang. Herald added a subscriber: cfe-commits.
- For template arguments ending with `>>>`, we should cease lookahead and treat it as type-id firstly, so that deduction could work properly. Repository: rG LLVM Github Monorepo 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,8 @@ template<typename T=int> struct S {}; template<typename> void f(); +template<typename T, typename... V> struct S<T(V...)> {}; + void foo(void) { // In C++11 mode, all of these are expected to parse correctly, and the CUDA @@ -21,4 +23,6 @@ (void)(&f<S<S<int>>>==0); (void)(&f<S<S<>>>==0); + + S<S<S<void()>>> s6; } Index: clang/lib/Parse/ParseTentative.cpp =================================================================== --- clang/lib/Parse/ParseTentative.cpp +++ clang/lib/Parse/ParseTentative.cpp @@ -593,7 +593,8 @@ (Tok.is(tok::greatergreater) || (Tok.is(tok::ellipsis) && NextToken().isOneOf(tok::greater, tok::greatergreater, - tok::comma)))))) { + tok::comma)))) || + (getLangOpts().CUDA && Tok.is(tok::greatergreatergreater)))) { TPR = TPResult::True; isAmbiguous = true;
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,8 @@ template<typename T=int> struct S {}; template<typename> void f(); +template<typename T, typename... V> struct S<T(V...)> {}; + void foo(void) { // In C++11 mode, all of these are expected to parse correctly, and the CUDA @@ -21,4 +23,6 @@ (void)(&f<S<S<int>>>==0); (void)(&f<S<S<>>>==0); + + S<S<S<void()>>> s6; } Index: clang/lib/Parse/ParseTentative.cpp =================================================================== --- clang/lib/Parse/ParseTentative.cpp +++ clang/lib/Parse/ParseTentative.cpp @@ -593,7 +593,8 @@ (Tok.is(tok::greatergreater) || (Tok.is(tok::ellipsis) && NextToken().isOneOf(tok::greater, tok::greatergreater, - tok::comma)))))) { + tok::comma)))) || + (getLangOpts().CUDA && Tok.is(tok::greatergreatergreater)))) { TPR = TPResult::True; isAmbiguous = true;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits