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

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).