public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression
@ 2021-04-04 18:30 hewillk at gmail dot com
  2021-04-06 18:59 ` [Bug c++/99909] " jason at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-04-04 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99909
           Summary: The value of 'std::is_integral_v<auto>' is not usable
                    in a constant expression
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/jWr39rrsT

#include <concepts>

template <std::integral auto> 
struct S {};

template <template <std::integral auto> class>
constexpr auto f() {}

int main() {
  f<S>();
}

gcc rejects this code with:

In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:13:  
required for the satisfaction of 'integral<auto [requires
std::integral<<placeholder>, >]>' [with auto [requires
std::integral<<placeholder>, >] = auto [requires std::integral<<placeholder>,
>]]
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:24:
error: the value of 'std::is_integral_v<auto [requires
std::integral<<placeholder>, >]>' is not usable in a constant expression
  102 |     concept integral = is_integral_v<_Tp>;
      |                        ^~~~~~~~~~~~~~~~~~
In file included from
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:44,
                 from <source>:1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits: In
function 'int main()':
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits:3026:25:
note: 'std::is_integral_v<auto [requires std::integral<<placeholder>, >]>' used
in its own initializer
 3026 |   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
      |                         ^~~~~~~~~~~~~

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
@ 2021-04-06 18:59 ` jason at gcc dot gnu.org
  2021-06-29 14:23 ` giecrilj at stegny dot 2a.pl
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-06 18:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-06
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |67491


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
  2021-04-06 18:59 ` [Bug c++/99909] " jason at gcc dot gnu.org
@ 2021-06-29 14:23 ` giecrilj at stegny dot 2a.pl
  2021-06-29 15:17 ` hewillk at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: giecrilj at stegny dot 2a.pl @ 2021-06-29 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

Christopher Yeleighton <giecrilj at stegny dot 2a.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giecrilj at stegny dot 2a.pl

--- Comment #1 from Christopher Yeleighton <giecrilj at stegny dot 2a.pl> ---
(In reply to 康桓瑋 from comment #0)
> template <template <std::integral auto> class>
> constexpr auto f() {}

That means auto is void, doesn’t it?

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
  2021-04-06 18:59 ` [Bug c++/99909] " jason at gcc dot gnu.org
  2021-06-29 14:23 ` giecrilj at stegny dot 2a.pl
@ 2021-06-29 15:17 ` hewillk at gmail dot com
  2021-09-27 19:38 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-06-29 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Christopher Yeleighton from comment #1)
> (In reply to 康桓瑋 from comment #0)
> > template <template <std::integral auto> class>
> > constexpr auto f() {}
> 
> That means auto is void, doesn’t it?

Yes, the second auto just means void.

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-06-29 15:17 ` hewillk at gmail dot com
@ 2021-09-27 19:38 ` ppalka at gcc dot gnu.org
  2021-09-28 21:26 ` cvs-commit at gcc dot gnu.org
  2021-09-28 21:27 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-09-27 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2021-09-27 19:38 ` ppalka at gcc dot gnu.org
@ 2021-09-28 21:26 ` cvs-commit at gcc dot gnu.org
  2021-09-28 21:27 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-28 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:daa762f01d8cf932484b7df122a5e872439bc92c

commit r12-3950-gdaa762f01d8cf932484b7df122a5e872439bc92c
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Sep 28 17:26:20 2021 -0400

    c++: ttp matching with constrained auto parm [PR99909]

    Here, when unifying TT with S, processing_template_decl is unset, and
    this foils the dependence checks in do_auto_deduction for avoiding
    checking constraints on an auto when the initializer is dependent.

    This patch fixes this by making sure processing_template_decl is set
    around the call to unify from coerce_template_template_parms; this seems
    sensible because we're unifying one set of template parameters with
    another, so we're dealing with templated trees throughout.

            PR c++/99909

    gcc/cp/ChangeLog:

            * pt.c (coerce_template_template_parms): Keep
            processing_template_decl set around the call to unify as well.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-ttp3.C: New test.

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

* [Bug c++/99909] The value of 'std::is_integral_v<auto>' is not usable in a constant expression
  2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2021-09-28 21:26 ` cvs-commit at gcc dot gnu.org
@ 2021-09-28 21:27 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-09-28 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12, thanks for the report.

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

end of thread, other threads:[~2021-09-28 21:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04 18:30 [Bug c++/99909] New: The value of 'std::is_integral_v<auto>' is not usable in a constant expression hewillk at gmail dot com
2021-04-06 18:59 ` [Bug c++/99909] " jason at gcc dot gnu.org
2021-06-29 14:23 ` giecrilj at stegny dot 2a.pl
2021-06-29 15:17 ` hewillk at gmail dot com
2021-09-27 19:38 ` ppalka at gcc dot gnu.org
2021-09-28 21:26 ` cvs-commit at gcc dot gnu.org
2021-09-28 21:27 ` ppalka 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).