This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR64959: SFINAE in UDLs


Hi,

Thanks for the review. I updated the patch.

2015-2-9 Andrea Azzarone <azzaronea@gmail.com>
    PR c++/64959

    * parser.c (lookup_literal_operator): Return all candidates.
      (cp_parser_userdef_char_literal): Simplify error handling.
      (cp_parser_userdef_numeric_literal):  Pass tf_warning_or_error.
      (cp_parser_userdef_string_literal): Pass tf_warning_or_error.
Also give higher priority to standard string UDL operator.

    * gcc/testsuite/g++.dg/cpp0x/udlit-namespace-ambiguous.C: Added
test case to make sure gcc detects ambiguous UDL declarations.
    * gcc/testsuite/g++.dg/cpp0x/udlit-namespace-using-directive.C:
Added test case to make sure gcc correctly handles using directive for
UDLs.
    * gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C: Removed a incorrect test case.
    * gcc/testsuite/g++.dg/cpp0x/udlit-sfinae.C: Added a test case to
make sure that enable_if can be used to select between overloads of
UDLs.
    * gcc/testsuite/g++.dg/cpp0x/udlit-sfinae-neg.C: Added a test case
to make sure gcc correctly detects substitution failures when all the
UDSL overloads are disabled by enable_if.
    * gcc/testsuite/g++.dg/cpp1y/udlit-char-template-sfinae-neg.C:
Like cpp0x/udlit-sfinae-neg.C but for string template literals.
    * gcc/testsuite/g++.dg/cpp1y/udlit-char-template-sfinae.C: Like
cpp0x/udlit-sfinae.C but for string template literals.
    * gcc/testsuite/g++.dg/cpp1y/udlit-char-template-vs-std-literal-operator.C:
Added a test to make sure that string template literals have a smaller
priority than standard literal operators.

2015-02-10 18:18 GMT+01:00 Jason Merrill <jason@redhat.com>:
> On 02/09/2015 08:27 AM, Andrea Azzarone wrote:
>>
>> Please note that this is my first gcc patch
>
>
> Thanks, looks good!  A couple of nits:
>
>>     * gcc/cp/parser.c: Make sure lookup_literal_operator returns all
>> the possible candidates. Also improve the diagnostic messages.
>
>
> A ChangeLog entry should be per function, e.g.
>
>         * parser.c (lookup_literal_operator): Return all candidates.
>         (cp_parser_userdef_numeric_literal): Pass tf_warning_or_error.
>         (cp_parser_userdef_string_literal): Likewise.  Prefer the
>         non-template form.
>
>> @@ -4044,31 +4061,15 @@ cp_parser_userdef_string_literal (tree l
>>      {
>>        tree tmpl_args = make_string_pack (value);
>>        decl = lookup_template_function (decl, tmpl_args);
>> -      result = finish_call_expr (decl, &args, false, true, tf_none);
>> +      result = finish_call_expr (decl, &args, false, true,
>> tf_warning_or_error);
>>        if (result != error_mark_node)
>> -       {
>> -         release_tree_vector (args);
>> -         return result;
>> -       }
>> +        {
>> +          release_tree_vector (args);
>> +          return result;
>> +        }
>>      }
>
>
> Why not remove the test against error_mark_node here like you did in
> cp_parser_userdef_numeric_literal?
>
> Jason
>



-- 
Andrea Azzarone
http://launchpad.net/~andyrock
http://wiki.ubuntu.com/AndreaAzzarone

Attachment: udlit-patch.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]