re PR c++/79420 (ICE on invalid C++ code on x86_64-linux-gnu: in tsubst_copy, at cp/pt.c:14573)

PR c++/79420
	PR c++/79463
	* parser.c (cp_parser_postfix_dot_deref_expression): Avoid
	clobbering if the postfix expression isn't an EXPR_P.

	* g++.dg/cpp1y/pr79463.C: New.
	* g++.dg/template/incomplete10.C: New.
	* g++.dg/template/incomplete9.C: New.

From-SVN: r245440
This commit is contained in:
Marek Polacek 2017-02-14 17:33:21 +00:00 committed by Marek Polacek
parent ee139af532
commit 6f207d5810
6 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2017-02-14 Marek Polacek <polacek@redhat.com>
PR c++/79420
PR c++/79463
* parser.c (cp_parser_postfix_dot_deref_expression): Avoid
clobbering if the postfix expression isn't an EXPR_P.
2017-02-13 Jason Merrill <jason@redhat.com>
PR c++/79461 - ICE with lambda in constexpr constructor

View File

@ -7331,7 +7331,9 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
(scope, current_class_type))))
{
scope = complete_type (scope);
if (!COMPLETE_TYPE_P (scope))
if (!COMPLETE_TYPE_P (scope)
/* Avoid clobbering e.g. OVERLOADs or DECLs. */
&& EXPR_P (postfix_expression))
{
/* In a template, be permissive by treating an object expression
of incomplete type as dependent (after a pedwarn). */

View File

@ -1,3 +1,11 @@
2017-02-14 Marek Polacek <polacek@redhat.com>
PR c++/79420
PR c++/79463
* g++.dg/cpp1y/pr79463.C: New.
* g++.dg/template/incomplete10.C: New.
* g++.dg/template/incomplete9.C: New.
2017-02-14 H.J. Lu <hongjiu.lu@intel.com>
PR target/79498

View File

@ -0,0 +1,7 @@
// PR c++/79463
// { dg-options "-g" }
// { dg-do compile { target c++14 } }
struct A;
extern A a; // { dg-error "'a' has incomplete type" }
template < int > int f = a.x;

View File

@ -0,0 +1,13 @@
// PR c++/79420
struct S;
extern S s; // { dg-error "'s' has incomplete type" }
template<int> int f ()
{
return s.x;
}
void g ()
{
f<0> ();
}

View File

@ -0,0 +1,11 @@
// PR c++/79420
template<int> int f ()
{
return f.x; // { dg-error "overloaded function with no contextual type information" }
}
void g ()
{
f<0> ();
}