public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack
@ 2023-09-18  9:28 jakub at gcc dot gnu.org
  2023-09-18  9:28 ` [Bug c++/111455] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-18  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111455
           Summary: [14 Regression] Using incorrect cast operator on
                    integer_pack
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

As I wrote in
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630095.html
I'm not sure casting the argument to integer_type_node is the right thing.

Consider:
#include <utility>

template<long... V>
void foo (std::integer_sequence<long, V...>)
{}

template<typename ...T>
struct U
{
  static constexpr long value = 1;
  constexpr operator int() = delete;
  constexpr operator long() { return value; }
};
template<typename T>
struct R
{
  using S = std::make_integer_sequence<long, U<T> {}>;
  R () noexcept(noexcept(foo (S ()))) {}
};

int
main()
{
  R<long>();
}

is accepted when using clang++, but rejected on the trunk with
<source>: In instantiation of 'R<T>::R() [with T = long int]':
<source>:24:11:   required from here
<source>:18:31: error: use of deleted function 'constexpr U<T>::operator int()
[with T = {long int}]'
   18 |   R () noexcept(noexcept(foo (S ()))) {}
      |                               ^~~~
<source>:11:13: note: declared here
   11 |   constexpr operator int() = delete;
      |             ^~~~~~~~
(previously it has been rejected due to PR111357, but e.g. g++ 6.4 accepted
it).
Two template arguments std::make_integer_sequence is declared as
template<class T, T N>
    using make_integer_sequence = integer_sequence<T, see below>;
so I believe it should cast U<long> {} to long first before casting it further
to whatever it needs under the hood.

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

* [Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack
  2023-09-18  9:28 [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack jakub at gcc dot gnu.org
@ 2023-09-18  9:28 ` jakub at gcc dot gnu.org
  2023-09-18  9:41 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-18  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|13.2.1                      |14.0
   Target Milestone|---                         |14.0
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |redi at gcc dot gnu.org

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

* [Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack
  2023-09-18  9:28 [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack jakub at gcc dot gnu.org
  2023-09-18  9:28 ` [Bug c++/111455] " jakub at gcc dot gnu.org
@ 2023-09-18  9:41 ` redi at gcc dot gnu.org
  2023-09-23  7:40 ` cvs-commit at gcc dot gnu.org
  2023-09-23  7:41 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-18  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-09-18
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=111357
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Isn't this just PR 111357? Or at least, its root cause.

I said in the libstdc++ backports that the compiler bug had been fixed on
trunk, but that's not quite true, it has been mitigated for now. The actual bug
is still present though: the argument *should* be an integer already by the
time it gets to __integer_pack.

Do we need two PRs for it though?

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

* [Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack
  2023-09-18  9:28 [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack jakub at gcc dot gnu.org
  2023-09-18  9:28 ` [Bug c++/111455] " jakub at gcc dot gnu.org
  2023-09-18  9:41 ` redi at gcc dot gnu.org
@ 2023-09-23  7:40 ` cvs-commit at gcc dot gnu.org
  2023-09-23  7:41 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-23  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:59d27cc55a0588ed7b03bef804662cb844e8a24d

commit r14-4236-g59d27cc55a0588ed7b03bef804662cb844e8a24d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 23 09:38:42 2023 +0200

    testsuite: Add new test for already fixed PR111455

    The following testcase has been fixed by r14-4231.

    2023-09-23  Jakub Jelinek  <jakub@redhat.com>

            PR c++/111455
            * g++.dg/ext/integer-pack8.C: New test.

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

* [Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack
  2023-09-18  9:28 [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-23  7:40 ` cvs-commit at gcc dot gnu.org
@ 2023-09-23  7:41 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-09-23  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dup of PR111357, now fixed.

*** This bug has been marked as a duplicate of bug 111357 ***

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

end of thread, other threads:[~2023-09-23  7:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18  9:28 [Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack jakub at gcc dot gnu.org
2023-09-18  9:28 ` [Bug c++/111455] " jakub at gcc dot gnu.org
2023-09-18  9:41 ` redi at gcc dot gnu.org
2023-09-23  7:40 ` cvs-commit at gcc dot gnu.org
2023-09-23  7:41 ` jakub 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).