<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 --- - invalid function template argument deduction when used with alias template"
href="http://llvm.org/bugs/show_bug.cgi?id=21405">21405</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>invalid function template argument deduction when used with alias template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>filip.roseen@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>Created <span class=""><a href="attachment.cgi?id=13258" name="attach_13258" title="testcase.cpp">attachment 13258</a> <a href="attachment.cgi?id=13258&action=edit" title="testcase.cpp">[details]</a></span>
testcase.cpp
template<class T>
using universal_ref = T&&;
template<class T>
void func (universal_ref<T> x) { }
int main () {
int a;
func (a);
}
-------------------------------------------------------------------------------
`clang` inaccurately rejects the above snippet with the following
diagnostic:
note: candidate function [with T = int] not viable: no
known conversion from 'int' to 'universal_ref<int>' (aka
'int &&') for 1st argument void func (universal_ref<T>) {
All of `gcc`, `vc++`, and `icc`, correctly accepts it and effectively
instantiates `func<int&>`.
-------------------------------------------------------------------------------
[temp.deduct.call]p3:
> If `P` is a cv-qualified type, the top level cv-qualifiers of
> `P`'s type are ignored for type deduction. If `P` is a reference
> type, the type referred to by `P` is used for type deduction. If
> `P` is an rvalue reference to a cv-unqualified template parameter
> and the argument is an lvalue, the type "lvalue reference to A" is
> used in place for `A` for type deduction.
[temp.alias]p2:
> When a template-id refers to the specialization of an alias
> template, it is equivalent to the associated type obtained by
> substitution of its template-arguments for the template-parameters
> in the type-id of the alias template.
-------------------------------------------------------------------------------</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>