[PATCH] D61396: [hip] Fix ambiguity from `>>>` of CUDA.
Michael Liao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 1 13:12:29 PDT 2019
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61396.197624.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190501/06f03753/attachment.bin>
More information about the cfe-commits
mailing list