public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110212] New: ICE on invalid: template constraint failure
@ 2023-06-11 20:27 stevenxia990430 at gmail dot com
  2023-06-11 20:31 ` [Bug c++/110212] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: stevenxia990430 at gmail dot com @ 2023-06-11 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110212
           Summary: ICE on invalid: template constraint failure
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following invalid program produces internal compiler error: error reporting
routines re-entered (related to template constraints). Tested on GCC-trunk.
Apologies that it might be complex, had a difficult time trying to reduce this.

To quickly reproduce: https://gcc.godbolt.org/z/7hxdx6Y6Y
```
#include <array>
#include <iostream>
#include <type_traits>

template<typename T>
struct foo<T, std::void_t<decltype(std::declval<std::ostream&>() <<
std::declval<T>().size())>> : std::true_type {};

template<typename T, typename std::enable_if_t<foo<T>::value>* = nullptr>
auto print_elements(T const& t) -> decltype(std::declval<std::ostream&>() <<
std::declval<T>().size(), void())
{
    std::cout << t;
}

int main()
{
    std::array<int, 10U> a{ 2, 0, 5, 66, 4, 90, 25, 54, 23, 1 };
    print_elements(a);
}
```

Note: requires -std=c++20 and above.

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

* [Bug c++/110212] ICE on invalid: template constraint failure
  2023-06-11 20:27 [Bug c++/110212] New: ICE on invalid: template constraint failure stevenxia990430 at gmail dot com
@ 2023-06-11 20:31 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-11 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is a dup of this bug.

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

end of thread, other threads:[~2023-06-11 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-11 20:27 [Bug c++/110212] New: ICE on invalid: template constraint failure stevenxia990430 at gmail dot com
2023-06-11 20:31 ` [Bug c++/110212] " pinskia 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).