This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix fallout from patch for PR c++/6634


My patch for PR 6634 to reject "long long double"
  http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00334.html
caused some fallout: The C++ frontend now accepts funny types like
"short void" or "long struct A". Ouch!

Apparently I missed the check below in grokdeclarator.

Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for mainline?

Regards,
Volker

:ADDPATCH C++:


2006-07-31  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/6634
	* decl.c (grokdeclarator): Check whether "long" or "short" was
	specified for non-integral types.

===================================================================
--- gcc/gcc/cp/decl.c	(revision 115837)
+++ gcc/gcc/cp/decl.c	(working copy)
@@ -7198,6 +7198,8 @@ grokdeclarator (const cp_declarator *declarator,
 	error ("%<long%> invalid for %qs", name);
       else if (short_p && TREE_CODE (type) == REAL_TYPE)
 	error ("%<short%> invalid for %qs", name);
+      else if ((long_p || short_p) && TREE_CODE (type) != INTEGER_TYPE)
+	error ("%<long%> or %<short%> invalid for %qs", name);
       else if ((long_p || short_p) && explicit_char)
 	error ("%<long%> or %<short%> specified with char for %qs", name);
       else if (long_p && short_p)
===================================================================

2006-07-31  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/6634
	* g++.dg/parse/long1.C: Add more tests.

===================================================================
--- gcc/gcc/testsuite/g++.dg/parse/long1.C	(revision 115837)
+++ gcc/gcc/testsuite/g++.dg/parse/long1.C	(working copy)
@@ -5,3 +5,7 @@
 long long double x; // { dg-error "long long" }
 long double y;
 long float z;       // { dg-error "long" }
+
+typedef short void    SV; // { dg-error "short" }
+typedef long struct A LA; // { dg-error "long" }
+typedef short char    SC; // { dg-error "short" }
===================================================================



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]