OSDN Git Service

PR c++/6634
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Jul 2006 22:52:20 +0000 (22:52 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Jul 2006 22:52:20 +0000 (22:52 +0000)
* decl.c (grokdeclarator): Check whether "long" or "short" was
specified for non-integral types.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115843 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/long1.C

index 1a8b91f..4e85be1 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2006-07-28  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * Make-lang.in: Use $(HEADER_H) instead of header.h in dependencies.
index 20ad2e9..e9cf4b8 100644 (file)
@@ -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)
index bfc82a7..9887b2c 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-31  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/6634
+       * g++.dg/parse/long1.C: Add more tests.
+
 2006-07-30  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        * gfortran.dg/lrshift_1.c: New file.
index 628c86c..c22d791 100644 (file)
@@ -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" }