From: Paolo Carlini Date: Mon, 16 Jan 2017 09:09:30 +0000 (+0000) Subject: re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d2f3f1d2968d16c89b0c046d730ab57fa6875d4;p=gcc.git re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias) /c-family 2017-01-16 Paolo Carlini PR c++/71737 * c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE. /testsuite 2017-01-16 Paolo Carlini PR c++/71737 * g++.dg/cpp0x/pr71737.C: New. From-SVN: r244486 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 774ca4e0eda..525a73f93aa 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-01-16 Paolo Carlini + + PR c++/71737 + * c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE. + 2017-01-12 Martin Sebor (-Wformat-overflow): ...to this. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 15ead18d36d..085bea03ac4 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7419,16 +7419,18 @@ set_underlying_type (tree x) if (TYPE_NAME (TREE_TYPE (x)) == 0) TYPE_NAME (TREE_TYPE (x)) = x; } - else if (TREE_TYPE (x) != error_mark_node - && DECL_ORIGINAL_TYPE (x) == NULL_TREE) + else if (DECL_ORIGINAL_TYPE (x) == NULL_TREE) { tree tt = TREE_TYPE (x); DECL_ORIGINAL_TYPE (x) = tt; - tt = build_variant_type_copy (tt); - TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x)); - TYPE_NAME (tt) = x; - TREE_USED (tt) = TREE_USED (x); - TREE_TYPE (x) = tt; + if (tt != error_mark_node) + { + tt = build_variant_type_copy (tt); + TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x)); + TYPE_NAME (tt) = x; + TREE_USED (tt) = TREE_USED (x); + TREE_TYPE (x) = tt; + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e5731e510d..aeb050a77c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-16 Paolo Carlini + + PR c++/71737 + * g++.dg/cpp0x/pr71737.C: New. + 2017-01-16 Eric Botcazou * gnat.dg/opt62.adb: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71737.C b/gcc/testsuite/g++.dg/cpp0x/pr71737.C new file mode 100644 index 00000000000..384d9478452 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71737.C @@ -0,0 +1,13 @@ +// PR c++/78765 +// { dg-do compile { target c++11 } } + +template