<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 doesn't find member of 'voldemort'-struct of a function template in getter for it if the later is used in a functiontemplate that receives the 'voldemort'-type as argument"
href="http://llvm.org/bugs/show_bug.cgi?id=18219">18219</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang doesn't find member of 'voldemort'-struct of a function template in getter for it if the later is used in a functiontemplate that receives the 'voldemort'-type as argument
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>florian.weber@sfz-bw.de
</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>Clang rejects the following code:
=================================================
template<typename T> void use2(const T& arg) {
arg.fun();
}
template<typename T> void use1(T value) {
struct range_helper {
T x;
T fun() const { return x; }
};
use2(range_helper{value});
}
int main() {
use1(3);
}
=================================================
Error if compiled with 'clang++ -Wextra -pedantic -std=c++11 main.cpp':
=================================================
main.cpp:9:26: error: 'use1(int)::range_helper::fun()::range_helper::x' is not
a member of class 'const range_helper'
T fun() const { return x; }
^
main.cpp:2:6: note: in instantiation of member function
'use1(int)::range_helper::fun' requested here
arg.fun();
^
main.cpp:11:2: note: in instantiation of function template specialization
'use2<range_helper>' requested here
use2(range_helper{value});
^
main.cpp:15:2: note: in instantiation of function template specialization
'use1<int>' requested here
use1(3);
^
1 error generated.
=================================================
I believe that this code is legal and gcc agrees with me.
Even if it were illegal, the error-message would be terrible and should be
fixed.</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>