aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>2006-03-15 15:27:11 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2006-03-15 15:27:11 +0000
commit3cc189f5e7d95a43aab520e9616fde990e95d95c (patch)
treed3a7cea02a61470a82627bb9229b462119556fcb /gcc
parent697701ad65fdb31eadfbd1927d6da6845b558bbd (diff)
downloadgcc-3cc189f5e7d95a43aab520e9616fde990e95d95c.zip
gcc-3cc189f5e7d95a43aab520e9616fde990e95d95c.tar.gz
gcc-3cc189f5e7d95a43aab520e9616fde990e95d95c.tar.bz2
re PR c++/6634 (wrong parsing of "long long double")
PR c++/6634 decl.c (grokdeclarator): Do not accept long long double. Reorganize checks for invalid (combinations of) type modifiers. Quote modifiers in messages. g++.dg/parse/long1.C: New test. From-SVN: r112084
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c26
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/long1.C7
4 files changed, 33 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 77c0309..b3f4111 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/6634
+ decl.c (grokdeclarator): Do not accept long long double.
+ Reorganize checks for invalid (combinations of) type modifiers.
+ Quote modifiers in messages.
+
2006-03-09 Jason Merrill <jason@redhat.com>
PR c++/16387, c++/16389
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d0866dc..bb6a59c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7085,7 +7085,7 @@ grokdeclarator (const cp_declarator *declarator,
and check for invalid combinations. */
/* Long double is a special combination. */
- if (long_p && TYPE_MAIN_VARIANT (type) == double_type_node)
+ if (long_p && !longlong && TYPE_MAIN_VARIANT (type) == double_type_node)
{
long_p = false;
type = build_qualified_type (long_double_type_node,
@@ -7098,18 +7098,20 @@ grokdeclarator (const cp_declarator *declarator,
{
int ok = 0;
- if (TREE_CODE (type) == REAL_TYPE)
- error ("short, signed or unsigned invalid for %qs", name);
- else if (TREE_CODE (type) != INTEGER_TYPE)
- error ("long, short, signed or unsigned invalid for %qs", name);
- else if (long_p && short_p)
- error ("long and short specified together 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) && TREE_CODE (type) == REAL_TYPE)
- error ("long or short specified with floating type for %qs", name);
+ if ((signed_p || unsigned_p) && TREE_CODE (type) != INTEGER_TYPE)
+ error ("%<signed%> or %<unsigned%> invalid for %qs", name);
else if (signed_p && unsigned_p)
- error ("signed and unsigned given together for %qs", name);
+ error ("%<signed%> and %<unsigned%> specified together for %qs", name);
+ else if (longlong && TREE_CODE (type) != INTEGER_TYPE)
+ error ("%<long long%> invalid for %qs", name);
+ else if (long_p && TREE_CODE (type) == REAL_TYPE)
+ 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) && explicit_char)
+ error ("%<long%> or %<short%> specified with char for %qs", name);
+ else if (long_p && short_p)
+ error ("%<long%> and %<short%> specified together for %qs", name);
else
{
ok = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ec0cd75..26255b3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/6634
+ g++.dg/parse/long1.C: New test.
+
2006-03-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/19101
diff --git a/gcc/testsuite/g++.dg/parse/long1.C b/gcc/testsuite/g++.dg/parse/long1.C
new file mode 100644
index 0000000..628c86c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/long1.C
@@ -0,0 +1,7 @@
+// PR c++/6634
+// { dg-do compile }
+// { dg-options "" }
+
+long long double x; // { dg-error "long long" }
+long double y;
+long float z; // { dg-error "long" }