<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 --- - Incorrect dependent template name error"
href="http://llvm.org/bugs/show_bug.cgi?id=17401">17401</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect dependent template name error
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>temporal@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>In the code shown below, Clang claims that the call to `foo` within `C::baz()`
is template-dependent and therefore must be prefixed with the `template`
keyword. I'm not a standards expert, but it does not appear to me to be
template-dependent -- the call clearly always resolves to `A::foo()`.
Moreover, if the type of `C::b` is changed to `B*` and the call becomes
`b->bar().foo<T>()` then no error is reported, which seems pretty suspicious.
Tested on Clang 3.2 (Ubuntu) and Clang 3.3 (Xcode 5).
G++ (4.7, 4.8) does not report an error on this code.
$ cat test.c++
class A {
public:
template <typename T>
T foo();
};
class B {
public:
A bar();
};
template <typename T>
class C {
public:
T baz() {
return b.bar().foo<T>();
}
private:
B b;
};
$ clang++ -c test.c++
test.c++:16:20: error: use 'template' keyword to treat 'foo' as a dependent
template name
return b.bar().foo<T>();
^
template
1 error generated.
$</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>