https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107348

Alejandro Colomar <alx at kernel dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #7 from Alejandro Colomar <alx at kernel dot org> ---
I just realized it was fixed recently.  Thanks!


commit 53d834a7fae3afffebb45a2d66908f705773a7fc
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Sep 20 18:37:29 2023 +0200

    c, c++: Accept __builtin_classify_type (typename)

    As mentioned in my stdckdint.h mail, __builtin_classify_type has
    a problem that argument promotion (the argument is passed to ...
    prototyped builtin function) means that certain type classes will
    simply never appear.
    I think it is too late to change how it behaves, lots of code in the
    wild might rely on the current behavior.

    So, the following patch adds option to use a typename rather than
    expression as the operand to the builtin, making it behave similarly
    to sizeof, typeof or say the clang _Generic extension where the
    first argument can be there not just expression, but also typename.

    I think we have other prior art here, e.g. __builtin_va_arg also
    expects typename.

    I've added this to both C and C++, because it would be weird if it
    supported it only in C and not in C++.

    2023-09-20  Jakub Jelinek  <ja...@redhat.com>

    gcc/
            * builtins.h (type_to_class): Declare.
            * builtins.cc (type_to_class): No longer static.  Return
            int rather than enum.
            * doc/extend.texi (__builtin_classify_type): Document.
    gcc/c/
            * c-parser.cc (c_parser_postfix_expression_after_primary): Parse
            __builtin_classify_type call with typename as argument.
    gcc/cp/
            * parser.cc (cp_parser_postfix_expression): Parse
            __builtin_classify_type call with typename as argument.
            * pt.cc (tsubst_copy_and_build): Handle __builtin_classify_type
            with dependent typename as argument.
    gcc/testsuite/
            * c-c++-common/builtin-classify-type-1.c: New test.
            * g++.dg/ext/builtin-classify-type-1.C: New test.
            * g++.dg/ext/builtin-classify-type-2.C: New test.
            * gcc.dg/builtin-classify-type-1.c: New test.

Reply via email to