Message ID | CADzB+2n2p=_cq5nXfqSEQmarVN-5Rh3p=RBCkVk2jGFEtzyrug@mail.gmail.com |
---|---|
State | New |
Headers | show |
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 1d8f336..2467a3d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2671,6 +2671,11 @@ finish_compound_literal (tree type, tree compound_literal, return error_mark_node; } + if (tree anode = type_uses_auto (type)) + if (CLASS_PLACEHOLDER_TEMPLATE (anode)) + type = do_auto_deduction (type, compound_literal, anode, complain, + adc_variable_type); + if (processing_template_decl) { TREE_TYPE (compound_literal) = type; diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction18.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction18.C new file mode 100644 index 0000000..ab2126e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction18.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++1z } + +template<class T> struct S{S(T){}}; + +int main() { + S{1}; +}