re PR c++/6634 (wrong parsing of "long long double")
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 31 Jul 2006 22:52:20 +0000 (22:52 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 31 Jul 2006 22:52:20 +0000 (22:52 +0000)
PR c++/6634
* decl.c (grokdeclarator): Check whether "long" or "short" was
specified for non-integral types.

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

From-SVN: r115843

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

index 1a8b91f3b72f797d69236a2287b29470f3c5db53..4e85be176dbd980237c9742ee5bbfec5c1c22a17 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 20ad2e98fa5fe21b4ae79fb7b985d6c3fc5ab25f..e9cf4b83022ea7aaf516d672fe901b7873cd1b3e 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 bfc82a7781c95913042d4fcbd5016945dde9234c..9887b2cdc4a442b4e03c0fd5c0d8583cc68e03d8 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 628c86c98942f261f2f8ba8d95817f2eb9bf1cb0..c22d79117bb85ead9e3f23123d80343aaaa984bc 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" }