From: Jason Merrill Date: Wed, 5 Oct 2016 18:57:45 +0000 (-0400) Subject: * semantics.c (finish_compound_literal): Handle class placeholder. X-Git-Tag: basepoints/gcc-8~4166 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b7033e0e1d10099b5c531a9a3b960fded60e24c;p=thirdparty%2Fgcc.git * semantics.c (finish_compound_literal): Handle class placeholder. From-SVN: r240802 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dd43d9880a90..40cbb97a6c28 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2016-10-05 Jason Merrill + + * semantics.c (finish_compound_literal): Handle class placeholder. + 2016-10-05 Marek Polacek Implement P0305R1, Selection statements with initializer. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index cae5afc0d4be..1b19f600cb7e 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 000000000000..ab2126e70a1e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction18.C @@ -0,0 +1,7 @@ +// { dg-options -std=c++1z } + +template struct S{S(T){}}; + +int main() { + S{1}; +}