PR c++/63149 - wrong auto deduction from braced-init-list

2019-06-04  Nina Dinka Ranns  <dinka.ranns@gmail.com>

    gcc/cp/
    * pt.c (listify_autos): Use non cv qualified auto_node in
    std::initializer_list<auto>.

    testsuite/
    * g++.dg/cpp0x/initlist-deduce2.C: New test.

From-SVN: r271968
This commit is contained in:
Nina Dinka Ranns 2019-06-05 14:11:20 -04:00 committed by Jason Merrill
parent 781d39f26e
commit 9b79d5d3ba
2 changed files with 9 additions and 1 deletions

View File

@ -26836,7 +26836,7 @@ listify (tree arg)
static tree static tree
listify_autos (tree type, tree auto_node) listify_autos (tree type, tree auto_node)
{ {
tree init_auto = listify (auto_node); tree init_auto = listify (strip_top_quals (auto_node));
tree argvec = make_tree_vec (1); tree argvec = make_tree_vec (1);
TREE_VEC_ELT (argvec, 0) = init_auto; TREE_VEC_ELT (argvec, 0) = init_auto;
if (processing_template_decl) if (processing_template_decl)

View File

@ -0,0 +1,8 @@
// Test for PR63149
// { dg-do compile { target c++11 } }
#include <initializer_list>
const auto r = { 1, 2, 3 };
using X = decltype(r);
using X = const std::initializer_list<int>;