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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:97f76b5fc4b637033229e53033b4f8b6dc23472c

commit r12-7600-g97f76b5fc4b637033229e53033b4f8b6dc23472c
Author: Marek Polacek <pola...@redhat.com>
Date:   Wed Mar 2 12:12:33 2022 -0500

    c++: Don't allow type-constraint auto(x) [PR104752]

    104752 points out that

      template<class T>
      concept C = true;
      auto y = C auto(1);

    is ill-formed as per [dcl.type.auto.deduct]: "For an explicit type
conversion,
    T is the specified type, which shall be auto." which doesn't allow
    type-constraint auto.

            PR c++/104752

    gcc/cp/ChangeLog:

            * semantics.cc (finish_compound_literal): Disallow auto{x} for
            is_constrained_auto.
            * typeck2.cc (build_functional_cast_1): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/auto-fncast12.C: New test.

Reply via email to