]> granicus.if.org Git - clang/commit
[c++1z] Synthesize implicit deduction guides from constructors on demand. Rank
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Feb 2017 00:25:28 +0000 (00:25 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Feb 2017 00:25:28 +0000 (00:25 +0000)
commit5b38d7133e9cd36796e369aaa8f58b51dfe972d1
treeeb21ceb0e35fab5fe4e3a6821082ce1e01ce757f
parent515451d31036344d4a58d8145eeb5795d0d3980a
[c++1z] Synthesize implicit deduction guides from constructors on demand. Rank
such guides below explicit ones, and ensure that references to the class's
template parameters are not treated as forwarding references.

We make a few tweaks to the wording in the current standard:
1) The constructor parameter list is copied faithfully to the deduction guide,
   without losing default arguments or a varargs ellipsis (which the standard
   wording loses by omission).
2) If the class template declares no constructors, we add a T() -> T<...> guide
   (which will only ever work if T has default arguments for all non-pack
   template parameters).
3) If the class template declares nothing that looks like a copy or move
   constructor, we add a T(T<...>) -> T<...> guide.
#2 and #3 follow from the "pretend we had a class type with these constructors"
philosophy for deduction guides.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295007 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/clang/AST/ASTContext.h
include/clang/AST/DeclTemplate.h
include/clang/Sema/Sema.h
lib/AST/ASTContext.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaLookup.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
test/CXX/expr/expr.post/expr.type.conv/p1.cpp
test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp
test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
test/Parser/cxx1z-class-template-argument-deduction.cpp