diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-17 13:42:37 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-17 13:42:37 -0500 |
commit | b10c7cd74ac9c17f0aa1cb5dbdb0e1227b421a90 (patch) | |
tree | fe0de2891ca4a29bec118a4e28289b6e6f356bc5 /gcc | |
parent | 34a64e47cdb877bbc749575578fa86e2ae0bc1c9 (diff) | |
download | gcc-b10c7cd74ac9c17f0aa1cb5dbdb0e1227b421a90.zip gcc-b10c7cd74ac9c17f0aa1cb5dbdb0e1227b421a90.tar.gz gcc-b10c7cd74ac9c17f0aa1cb5dbdb0e1227b421a90.tar.bz2 |
PR c++/79556 - C++17 ICE with non-type auto
* pt.c (do_auto_deduction): Don't try to deduce from null type.
From-SVN: r245543
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/nontype-auto9.C | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a1e4948..65f2d19 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-02-17 Jason Merrill <jason@redhat.com> + PR c++/79556 - C++17 ICE with non-type auto + * pt.c (do_auto_deduction): Don't try to deduce from null type. + PR c++/79533 - C++17 ICE with temporary cast to reference * call.c (build_over_call): Conversion to a reference prevents copy elision. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 73d6be3..093c0f9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25191,6 +25191,10 @@ do_auto_deduction (tree type, tree init, tree auto_node, /* C++17 class template argument deduction. */ return do_class_deduction (type, tmpl, init, flags, complain); + if (TREE_TYPE (init) == NULL_TREE) + /* Nothing we can do with this, even in deduction context. */ + return type; + /* [dcl.spec.auto]: Obtain P from T by replacing the occurrences of auto with either a new invented type template parameter U or, if the initializer is a braced-init-list (8.5.4), with diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto9.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto9.C new file mode 100644 index 0000000..2daa346 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto9.C @@ -0,0 +1,8 @@ +// PR c++/79556 +// { dg-options -std=c++1z } + +template <auto> struct A; +template <auto...> struct B; +template <int N, auto Dim, auto... Dims> struct B<N, Dim, Dims...> { + static auto a = A<B<Dims...>::value>::value; +}; |