<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Clang fails to parse some template code when running with -x cuda -std=c++11"
href="http://llvm.org/bugs/show_bug.cgi?id=20081">20081</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang fails to parse some template code when running with -x cuda -std=c++11
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eliben@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Background: r209824 fixed a bug that made -std options mask out -x cuda. Prior
to that, when "-std=c++11 -x cuda" were specified together, CUDA mode was not
activated.
Now that both CUDA mode and C++11 mode can be active together, we run into a
problem parsing certain C++11 code in CUDA mode. Here's a simple reproducer:
template <typename T>
struct K1 {
T member;
};
template <typename T>
struct K2 {
T member;
};
template <typename T>
struct K3 {
T member;
};
K3<K2<K1<int>>> var;
Compiled just with -std=c++11 this works fine. With "-std=c++11 -x cuda",
however, we get:
error: a space is required between consecutive right angle brackets (use '> >')
K3<K2<K1<int>>> var;
^~
> >
Running -cc1 -dump-tokens clarifies what's going on. In the absence of "-x
cuda", the ">>>" on the last line is taken as '>>' followed by '>', which the
template parser knows how to handle.
In CUDA mode, it's read as a single token - '>>>', which the parser does not
know how to handle.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>