http://llvm.org/bugs/show_bug.cgi?id=21405
Bug ID: 21405
Summary: invalid function template argument deduction when used
with alias template
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 13258
--> http://llvm.org/bugs/attachment.cgi?id=13258&action=edit
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.
-------------------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs