mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
902828f01c
commit
f05eec4a0d
|
@ -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>
|
2011-11-10 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/50372
|
PR c++/50372
|
||||||
|
|
|
@ -8425,9 +8425,6 @@ check_literal_operator_args (const_tree decl,
|
||||||
tree argtype;
|
tree argtype;
|
||||||
int arity;
|
int arity;
|
||||||
int max_arity = 2;
|
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_long_unsigned_p = false;
|
||||||
*long_double_p = false;
|
*long_double_p = false;
|
||||||
|
@ -8442,29 +8439,30 @@ check_literal_operator_args (const_tree decl,
|
||||||
|
|
||||||
if (TREE_CODE (t) == POINTER_TYPE)
|
if (TREE_CODE (t) == POINTER_TYPE)
|
||||||
{
|
{
|
||||||
|
bool maybe_raw_p = false;
|
||||||
t = TREE_TYPE (t);
|
t = TREE_TYPE (t);
|
||||||
if (cp_type_quals (t) != TYPE_QUAL_CONST)
|
if (cp_type_quals (t) != TYPE_QUAL_CONST)
|
||||||
return false;
|
return false;
|
||||||
t = TYPE_MAIN_VARIANT (t);
|
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;
|
argtype = TREE_CHAIN (argtype);
|
||||||
maybe_raw_p = true;
|
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))
|
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)
|
if (arity > max_arity)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (found_string_p && !maybe_raw_p && !found_size_p)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue