Index: lib/Parse/ParseTemplate.cpp =================================================================== --- lib/Parse/ParseTemplate.cpp +++ lib/Parse/ParseTemplate.cpp @@ -751,7 +751,9 @@ // This template-id is terminated by a token which starts with a '>'. Outside // C++11, this is now error recovery, and in C++11, this is error recovery if - // the token isn't '>>'. + // the token isn't '>>' or '>>>'. + // '>>>' is for CUDA, where this sequence of characters is parsed into + // tok::greatergreatergreater, rather than two separate tokens. RAngleLoc = Tok.getLocation(); @@ -781,7 +783,8 @@ Hint2 = FixItHint::CreateInsertion(Next.getLocation(), " "); unsigned DiagId = diag::err_two_right_angle_brackets_need_space; - if (getLangOpts().CPlusPlus11 && Tok.is(tok::greatergreater)) + if (getLangOpts().CPlusPlus11 && + (Tok.is(tok::greatergreater) || Tok.is(tok::greatergreatergreater))) DiagId = diag::warn_cxx98_compat_two_right_angle_brackets; else if (Tok.is(tok::greaterequal)) DiagId = diag::err_right_angle_bracket_equal_needs_space; Index: test/Parser/cuda-kernel-call.cu =================================================================== --- test/Parser/cuda-kernel-call.cu +++ test/Parser/cuda-kernel-call.cu @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template struct S {}; template void f(); @@ -10,7 +10,7 @@ foo<<<>>>(); // expected-error {{expected expression}} - S>> s; // expected-error 2{{use '> >'}} - - (void)(&f>>==0); // expected-error 2{{use '> >'}} + // This is expected to work in C++11 mode + S>> s; + (void)(&f>>==0); }