public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL
@ 2024-01-13  0:33 mpolacek at gcc dot gnu.org
  2024-01-13 11:32 ` [Bug testsuite/113366] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-13  0:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113366
           Summary: g++.dg/cpp2a/concepts-pr67774.C FAIL
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

It appears that since r14-6569-gfe54b57728c09a:

commit fe54b57728c09ab0389e2bb3f079d5210566199d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Dec 14 23:23:34 2023 +0000

    libstdc++: Implement C++23 <print> header [PR107760]

there are two new FAILs:

FAIL: g++.dg/cpp2a/concepts-pr67774.C  -std=c++23 (test for excess errors)
FAIL: g++.dg/cpp2a/concepts-pr67774.C  -std=c++26 (test for excess errors)

$ xg++ -c -fconcepts-ts -std=c++26 concepts-pr67774.C
In file included from
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/ostream:43,
                 from
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:41,
                 from concepts-pr67774.C:6:
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/format:3193:45:
error: type/value mismatch at argument 1 in template parameter list for
‘template<bool _Cond, class _If, class _Else> using std::__conditional_t =
typename std::__conditional::type<_If, _Else>’
 3193 |                               const _Tp, _Tp>;
      |                                             ^
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/format:3193:45:
note:   expected a constant of type ‘bool’, got ‘auto [requires
std::__format::__formattable_with<<placeholder>, _Tp, _Context,
std::basic_format_parse_context<typename _Tp::char_type> >]’
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/format: In
constructor ‘std::basic_format_arg<_Context>::handle::handle(_Tp&)’:
/home/mpolacek/x/trunk/x86_64-pc-linux-gnu/libstdc++-v3/include/format:3216:37:
error: ‘__maybe_const_t’ was not declared in this scope; did you mean
‘remove_const_t’?
 3216 |             auto __func = _S_format<__maybe_const_t<_Tp>>;
      |                                     ^~~~~~~~~~~~~~~
      |                                     remove_const_t
[...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/113366] g++.dg/cpp2a/concepts-pr67774.C FAIL
  2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
@ 2024-01-13 11:32 ` redi at gcc dot gnu.org
  2024-01-13 11:40 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-13 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Odd.

We get the type/value mismatch from here:

        template<typename _Tp>
          using __maybe_const_t
            = __conditional_t<__format::__formattable_with<_Tp, _Context>,
                              const _Tp, _Tp>;


Where the boolean condition is:

  template<typename _Tp, typename _Context,
           typename _Formatter
             = typename _Context::template formatter_type<remove_const_t<_Tp>>,
           typename _ParseContext
             = basic_format_parse_context<typename _Context::char_type>>
    concept __formattable_with
      = semiregular<_Formatter>
          && requires (const _Formatter __cf, _Tp&& __t, _Context __fc)
    {
      { __cf.format(__t, __fc) } -> same_as<typename _Context::iterator>;
    };


That seems like a valid concept. Is something in the -fconcepts-ts code
tripping up?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/113366] g++.dg/cpp2a/concepts-pr67774.C FAIL
  2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
  2024-01-13 11:32 ` [Bug testsuite/113366] " redi at gcc dot gnu.org
@ 2024-01-13 11:40 ` redi at gcc dot gnu.org
  2024-01-13 11:48 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-13 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-13
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I already defined a constexpr bool variable template in that class, and using
it in the __maybe_const_t alias seems to fix the -fconcepts-ts problem:

        // Format as const if possible, to reduce instantiations.
        template<typename _Tp>
          using __maybe_const_t
            = __conditional_t<__formattable<_Tp>, const _Tp, _Tp>;

But then there are loads of other errors due to using attributes on constrained
functions:

format:4159:5: error: two consecutive '[' shall only introduce an attribute
before '[' token
 4159 |     [[__gnu__::__always_inline__]]

I'll need to move those attributes.

Or maybe I can just make <format> reject attempts to use it with -fconcepts-ts 
]:-)

<format> is C++20 code, so you don't need the Concepts TS. Fix your concepts to
work with C++20 instead!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/113366] g++.dg/cpp2a/concepts-pr67774.C FAIL
  2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
  2024-01-13 11:32 ` [Bug testsuite/113366] " redi at gcc dot gnu.org
  2024-01-13 11:40 ` redi at gcc dot gnu.org
@ 2024-01-13 11:48 ` redi at gcc dot gnu.org
  2024-01-15 17:18 ` cvs-commit at gcc dot gnu.org
  2024-01-18 21:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-13 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It seems like there's no macro predefined by the front end to tell me
-fconcepts-ts is being used? It defines __cpp_concepts=201507L for C++17 mode,
but for C++20 that is __cpp_concepts=202002L instead (as required for C++20).

If there was a macro telling me the non-C++20 -fconcepts-ts parsing code was in
use, I could just omit the always_inline attributes entirely. That would be
simpler.

Having no way to tell that the compiler is in a broken^W non-conforming mode
isn't helpful.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/113366] g++.dg/cpp2a/concepts-pr67774.C FAIL
  2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-13 11:48 ` redi at gcc dot gnu.org
@ 2024-01-15 17:18 ` cvs-commit at gcc dot gnu.org
  2024-01-18 21:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-15 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:6c703b4eb68cbc32de1d62e5b573cb1b9857af29

commit r14-7255-g6c703b4eb68cbc32de1d62e5b573cb1b9857af29
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Jan 13 12:13:33 2024 +0000

    libstdc++: Use variable template to fix -fconcepts-ts error [PR113366]

    There's an error for -fconcepts-ts due to using a concept where a bool
    NTTP is required, which is fixed by using the vraiable template that
    already exists in the class scope.

    This doesn't fix the problem with -fconcepts-ts as changes to the
    placement of attributes is also needed.

    libstdc++-v3/ChangeLog:

            PR testsuite/113366
            * include/std/format (basic_format_arg): Use __formattable
            variable template instead of __format::__formattable_with
            concept.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/113366] g++.dg/cpp2a/concepts-pr67774.C FAIL
  2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-15 17:18 ` cvs-commit at gcc dot gnu.org
@ 2024-01-18 21:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-18 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:35000c65470792aed3a3c23a3b3fc45db4bec2c4

commit r13-8237-g35000c65470792aed3a3c23a3b3fc45db4bec2c4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Jan 13 12:13:33 2024 +0000

    libstdc++: Use variable template to fix -fconcepts-ts error [PR113366]

    There's an error for -fconcepts-ts due to using a concept where a bool
    NTTP is required, which is fixed by using the vraiable template that
    already exists in the class scope.

    This doesn't fix the problem with -fconcepts-ts as changes to the
    placement of attributes is also needed.

    libstdc++-v3/ChangeLog:

            PR testsuite/113366
            * include/std/format (basic_format_arg): Use __formattable
            variable template instead of __format::__formattable_with
            concept.

    (cherry picked from commit 6c703b4eb68cbc32de1d62e5b573cb1b9857af29)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-18 21:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-13  0:33 [Bug testsuite/113366] New: g++.dg/cpp2a/concepts-pr67774.C FAIL mpolacek at gcc dot gnu.org
2024-01-13 11:32 ` [Bug testsuite/113366] " redi at gcc dot gnu.org
2024-01-13 11:40 ` redi at gcc dot gnu.org
2024-01-13 11:48 ` redi at gcc dot gnu.org
2024-01-15 17:18 ` cvs-commit at gcc dot gnu.org
2024-01-18 21:03 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).