diff options
author | Ed Smith-Rowland <3dw4rd@verizon.net> | 2011-11-11 16:51:41 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-11 11:51:41 -0500 |
commit | f05eec4a0d41f9b9b5ef0131407581c5edb6f79c (patch) | |
tree | 39c88c83ae08349e05c6c67fad20ad9e549d1539 /gcc | |
parent | 902828f01c0ea4c987dd227e0c11be8f2eb8dc9e (diff) | |
download | gcc-f05eec4a0d41f9b9b5ef0131407581c5edb6f79c.zip gcc-f05eec4a0d41f9b9b5ef0131407581c5edb6f79c.tar.gz gcc-f05eec4a0d41f9b9b5ef0131407581c5edb6f79c.tar.bz2 |
re PR c++/50976 ([C++0x] literal operator with unsigned long long parameter not accepted)
PR c++/50976
* typeck.c (check_literal_operator_args): Reorganize test for string
operators so size_t search depends on finding string first.
From-SVN: r181292
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 41 |
2 files changed, 24 insertions, 23 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9568030..291487f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-11-11 Ed Smith-Rowland <3dw4rd@verizon.net> + + PR c++/50976 + * typeck.c (check_literal_operator_args): Reorganize test for string + operators so size_t search depends on finding string first. + 2011-11-10 Jason Merrill <jason@redhat.com> PR c++/50372 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2964952..722cec5 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8425,9 +8425,6 @@ check_literal_operator_args (const_tree decl, tree argtype; int arity; int max_arity = 2; - bool found_string_p = false; - bool maybe_raw_p = false; - bool found_size_p = false; *long_long_unsigned_p = false; *long_double_p = false; @@ -8442,29 +8439,30 @@ check_literal_operator_args (const_tree decl, if (TREE_CODE (t) == POINTER_TYPE) { + bool maybe_raw_p = false; t = TREE_TYPE (t); if (cp_type_quals (t) != TYPE_QUAL_CONST) return false; t = TYPE_MAIN_VARIANT (t); - if (same_type_p (t, char_type_node)) + if ((maybe_raw_p = same_type_p (t, char_type_node)) + || same_type_p (t, wchar_type_node) + || same_type_p (t, char16_type_node) + || same_type_p (t, char32_type_node)) { - found_string_p = true; - maybe_raw_p = true; + argtype = TREE_CHAIN (argtype); + if (!argtype) + return false; + t = TREE_VALUE (argtype); + if (maybe_raw_p && argtype == void_list_node) + return true; + else if (same_type_p (t, size_type_node)) + { + ++arity; + continue; + } + else + return false; } - else if (same_type_p (t, wchar_type_node)) - found_string_p = true; - else if (same_type_p (t, char16_type_node)) - found_string_p = true; - else if (same_type_p (t, char32_type_node)) - found_string_p = true; - else - return false; - } - else if (same_type_p (t, size_type_node)) - { - if (!found_string_p) - return false; - found_size_p = true; } else if (same_type_p (t, long_long_unsigned_type_node)) { @@ -8493,9 +8491,6 @@ check_literal_operator_args (const_tree decl, if (arity > max_arity) return false; - if (found_string_p && !maybe_raw_p && !found_size_p) - return false; - return true; } } |