diff options
author | Jason Merrill <jason@redhat.com> | 2019-03-30 11:23:37 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-03-30 11:23:37 -0400 |
commit | 26b81a446f6e333bb5e80d40eb467260948ee79e (patch) | |
tree | cc213e86d10404931ff5de25e16bc3f1e5268a10 /gcc/testsuite | |
parent | 5c95b82b6172424908142c65a9c5c6d619e9579a (diff) | |
download | gcc-26b81a446f6e333bb5e80d40eb467260948ee79e.zip gcc-26b81a446f6e333bb5e80d40eb467260948ee79e.tar.gz gcc-26b81a446f6e333bb5e80d40eb467260948ee79e.tar.bz2 |
PR c++/89744 - ICE with specialization of member class template.
My fix five years ago for PR 60241 was incomplete: when we reassign implicit
instances of a partial instantiation of a member template to the explicit
specialization of that partial instantiation, we also need to adjust the
CLASSTYPE_TI_ARGS to match what we'd get when looking up that instance after
the explicit specialization. We also need to do this when we later look up
the instance in a way that only finds the explicit specialization halfway
through lookup_template_class_1.
* pt.c (lookup_template_class_1): If the partial instantiation is
explicitly specialized, adjust.
(maybe_process_partial_specialization): Also adjust
CLASSTYPE_TI_ARGS.
From-SVN: r270036
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.dg/template/mem-spec1.C | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/mem-spec1.C b/gcc/testsuite/g++.dg/template/mem-spec1.C new file mode 100644 index 0000000..b06df0a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/mem-spec1.C @@ -0,0 +1,68 @@ +// PR c++/89744 + +namespace N1 { + template<typename> struct A + { + template<typename> struct B {}; + A() { B<int> b; } + }; + + template<> template<typename> + struct A<int>::B + { + virtual void foo() {} + }; + + A<int> a; +} + +namespace N2 { + template<typename> struct A + { + template<typename> struct B {}; + A() { B<int> b; } + }; + + template<> template<typename> + struct A<int>::B + { + virtual void foo() {} + void bar() {} + }; + + A<int> a; +} + +namespace N3 { + template<typename> struct A + { + template<typename> struct B {}; + A() { B<int> b; } + }; + + template<> template<typename> + struct A<int>::B + { + ~B() {} + }; + + A<int> a; +} + +#if __cpp_variadic_templates +namespace N4 { + template<typename...> struct A + { + template<typename> struct B {}; + typedef B<int> X; + }; + + template<> template<typename> + struct A<int>::B + { + typedef int Y; + }; + + A<int>::B<int> b; +} +#endif |