diff options
author | Jason Merrill <jason@redhat.com> | 2011-10-26 15:31:26 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-10-26 15:31:26 -0400 |
commit | 24847495f3558a50ce191cc8c70bc4b24b58ac09 (patch) | |
tree | 26e06fbab5874f96fc25021e68ccb7caddad3290 /gcc | |
parent | 1ca3916f5688863f49976febd57b1a9640d1c71a (diff) | |
download | gcc-24847495f3558a50ce191cc8c70bc4b24b58ac09.zip gcc-24847495f3558a50ce191cc8c70bc4b24b58ac09.tar.gz gcc-24847495f3558a50ce191cc8c70bc4b24b58ac09.tar.bz2 |
* typeck.c (check_literal_operator_args): Avoid building types.
From-SVN: r180538
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 33 |
2 files changed, 22 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee942ca..3f4455e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2011-10-26 Jason Merrill <jason@redhat.com> + + * typeck.c (check_literal_operator_args): Avoid building types. + 2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net> Implement C++11 user-defined literals. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 59e1357..ec14934 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8405,12 +8405,6 @@ check_literal_operator_args (const_tree decl, bool found_string_p = false; bool maybe_raw_p = false; bool found_size_p = false; - tree const_wchar_ptr_type_node - = build_pointer_type (build_type_variant (wchar_type_node, 1, 0)); - tree const_char16_ptr_type_node - = build_pointer_type (build_type_variant (char16_type_node, 1, 0)); - tree const_char32_ptr_type_node - = build_pointer_type (build_type_variant (char32_type_node, 1, 0)); *long_long_unsigned_p = false; *long_double_p = false; @@ -8423,17 +8417,26 @@ check_literal_operator_args (const_tree decl, tree t = TREE_VALUE (argtype); ++arity; - if (same_type_p (t, const_string_type_node)) + if (TREE_CODE (t) == POINTER_TYPE) { - found_string_p = true; - maybe_raw_p = true; + 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)) + { + found_string_p = true; + maybe_raw_p = true; + } + 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, const_wchar_ptr_type_node)) - found_string_p = true; - else if (same_type_p (t, const_char16_ptr_type_node)) - found_string_p = true; - else if (same_type_p (t, const_char32_ptr_type_node)) - found_string_p = true; else if (same_type_p (t, size_type_node)) { if (!found_string_p) |