PR c++/88325 - ICE with invalid out-of-line template member definition.

* parser.c (cp_parser_class_name): Don't call make_typename_type
	for overloads.

	* g++.dg/cpp2a/typename14.C: New test.

From-SVN: r268455
This commit is contained in:
Marek Polacek 2019-02-01 19:58:44 +00:00 committed by Marek Polacek
parent e71ac16355
commit a53a893b4f
4 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2019-02-01 Marek Polacek <polacek@redhat.com>
PR c++/88325 - ICE with invalid out-of-line template member definition.
* parser.c (cp_parser_class_name): Don't call make_typename_type
for overloads.
2019-02-01 Jakub Jelinek <jakub@redhat.com>
PR c++/87175

View File

@ -23167,7 +23167,9 @@ cp_parser_class_name (cp_parser *parser,
decl = cp_parser_maybe_treat_template_as_class (decl, class_head_p);
/* If this is a typename, create a TYPENAME_TYPE. */
if (typename_p && decl != error_mark_node)
if (typename_p
&& decl != error_mark_node
&& !is_overloaded_fn (decl))
{
decl = make_typename_type (scope, decl, typename_type,
/*complain=*/tf_error);

View File

@ -1,3 +1,8 @@
2019-02-01 Marek Polacek <polacek@redhat.com>
PR c++/88325 - ICE with invalid out-of-line template member definition.
* g++.dg/cpp2a/typename14.C: New test.
2019-02-01 Richard Biener <rguenther@suse.de>
PR middle-end/88597

View File

@ -0,0 +1,25 @@
// PR c++/88325
// { dg-do compile { target c++2a } }
template<typename> struct A
{
template<typename> A ();
};
template<typename T>
template<typename U>
A<T>::A<U> () // { dg-error "partial specialization" }
{
}
template<typename> struct B
{
template<typename> int foo (int);
};
template<typename T>
template<typename U>
B<T>::foo<int>(int) // { dg-error "partial specialization|declaration" }
{
return 1;
}