Skip to content
Snippets Groups Projects
Commit 26ee9544 authored by Simon Martin's avatar Simon Martin
Browse files

c++: Check template parameters in member class template specialization [PR115716]

We currently ICE upon the following invalid code, because we don't check
that the template parameters in a member class template specialization
are correct.

=== cut here ===
template <typename T> struct x {
  template <typename U> struct y {
    typedef T result2;
  };
};
template<> template<typename U, typename> struct x<int>::y {
  typedef double result2;
};
int main() {
  x<int>::y<int>::result2 xxx2;
}
=== cut here ===

This patch fixes the PR by calling redeclare_class_template.

	PR c++/115716

gcc/cp/ChangeLog:

	* pt.cc (maybe_process_partial_specialization): Call
	redeclare_class_template.

gcc/testsuite/ChangeLog:

	* g++.dg/template/spec42.C: New test.
	* g++.dg/template/spec43.C: New test.
parent cc372be5
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment