diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-03-15 15:27:11 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-03-15 15:27:11 +0000 |
commit | 3cc189f5e7d95a43aab520e9616fde990e95d95c (patch) | |
tree | d3a7cea02a61470a82627bb9229b462119556fcb /gcc/cp | |
parent | 697701ad65fdb31eadfbd1927d6da6845b558bbd (diff) | |
download | gcc-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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 26 |
2 files changed, 21 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; |