diff mbox

[C++] Fix PR58979

Message ID 20131104105002.GB30062@redhat.com
State New
Headers show

Commit Message

Marek Polacek Nov. 4, 2013, 10:50 a.m. UTC
Even RO_ARROW_STAR can end up in invalid_indirection_error in invalid
code, so handle that instead of ICEing later on.

Regtested/bootstrapped on x86_64-linux, ok for trunk and 4.8?

2013-11-04  Marek Polacek  <polacek@redhat.com>

	PR c++/58979
c-family/
	* c-common.c (invalid_indirection_error): Handle RO_ARROW_STAR case.
testsuite/
	* g++.dg/diagnostic/pr58979.C: New test.


	Marek

Comments

Jason Merrill Nov. 4, 2013, 3:36 p.m. UTC | #1
On 11/04/2013 05:50 AM, Marek Polacek wrote:
>       case RO_ARROW:
> +    case RO_ARROW_STAR:
>         error_at (loc,
>   		"invalid type argument of %<->%> (have %qT)",
>   		type);

I think the diagnostic for RO_ARROW_STAR should say ->*, not just ->.

Jason
diff mbox

Patch

--- gcc/c-family/c-common.c.mp2	2013-11-04 10:30:15.265951084 +0100
+++ gcc/c-family/c-common.c	2013-11-04 10:47:29.164783425 +0100
@@ -9930,6 +9930,7 @@  invalid_indirection_error (location_t lo
 		type);
       break;
     case RO_ARROW:
+    case RO_ARROW_STAR:
       error_at (loc,
 		"invalid type argument of %<->%> (have %qT)",
 		type);
--- gcc/testsuite/g++.dg/diagnostic/pr58979.C.mp2	2013-11-04 11:09:30.515553664 +0100
+++ gcc/testsuite/g++.dg/diagnostic/pr58979.C	2013-11-04 11:09:26.505538785 +0100
@@ -0,0 +1,4 @@ 
+// PR c++/58979
+// { dg-do compile }
+
+int i = 0->*0; // { dg-error "invalid type argument of" }