From: Patrick Palka Date: Thu, 4 Aug 2016 19:14:32 +0000 (+0000) Subject: Fix ICE on invalid variable template instantiation (PR c++/72759) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=08156df50a56e4a4bd95159ad1bfbc50678f9e8a;p=gcc.git Fix ICE on invalid variable template instantiation (PR c++/72759) gcc/cp/ChangeLog: PR c++/72759 * pt.c (tsubst_qualified_id): Return error_mark_node if template_args is error_mark_node. gcc/testsuite/ChangeLog: PR c++/72759 * g++.dg/cpp1y/pr72759.C: New test. From-SVN: r239147 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 573ece8bbad..5ec690d6e2e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-08-04 Patrick Palka + + PR c++/72759 + * pt.c (tsubst_qualified_id): Return error_mark_node if + template_args is error_mark_node. + 2016-08-04 Jason Merrill PR c++/72415 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 60c87e001c0..2f40700538e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13832,6 +13832,8 @@ tsubst_qualified_id (tree qualified_id, tree args, if (template_args) template_args = tsubst_template_args (template_args, args, complain, in_decl); + if (template_args == error_mark_node) + return error_mark_node; name = TREE_OPERAND (name, 0); } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58672ba83a0..c456b1886de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-04 Patrick Palka + + PR c++/72759 + * g++.dg/cpp1y/pr72759.C: New test. + 2016-08-04 Patrick Palka * gcc.dg/switch-10.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp1y/pr72759.C b/gcc/testsuite/g++.dg/cpp1y/pr72759.C new file mode 100644 index 00000000000..4af6ea47120 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr72759.C @@ -0,0 +1,18 @@ +// PR c++/72759 +// { dg-do compile { target c++14 } } + +template struct SpecPerType; +class Specializer { + public: template static void MbrFnTempl(); + template struct A { static void InnerMemberFn(); }; + void Trigger() { A<0>::InnerMemberFn; } +}; +template <> struct SpecPerType { + using FnType = void *; + template + static constexpr FnType SpecMbrFnPtr = Specializer::MbrFnTempl

; +}; +template void Specializer::A::InnerMemberFn() { + using Spec = SpecPerType; + Spec ErrorSite = Spec::SpecMbrFnPtr; // { dg-error "not declared" } +}