diff options
author | Nina Dinka Ranns <dinka.ranns@gmail.com> | 2019-06-05 14:11:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-06-05 14:11:20 -0400 |
commit | 9b79d5d3baad087f145d64ae7f132be0aac3b901 (patch) | |
tree | e8afb3a095a314db4f2d4362737a9ad34fe99179 /gcc | |
parent | 781d39f26e0d5e9b8a0234525d8930e1d1f938bf (diff) | |
download | gcc-9b79d5d3baad087f145d64ae7f132be0aac3b901.zip gcc-9b79d5d3baad087f145d64ae7f132be0aac3b901.tar.gz gcc-9b79d5d3baad087f145d64ae7f132be0aac3b901.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist-deduce2.C | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cfbd9fd..d2cf345 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -26836,7 +26836,7 @@ listify (tree arg) static tree 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_VEC_ELT (argvec, 0) = init_auto; if (processing_template_decl) diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce2.C new file mode 100644 index 0000000..dbf68a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce2.C @@ -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>; |