| Summary: | ICE template template parameter with default parameter lambda | ||
|---|---|---|---|
| Product: | gcc | Reporter: | bastien penavayre <bastien.penavayre> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | friedkeenan, jason, marxin, mpolacek, oficsu, webrown.cpp |
| Priority: | P3 | Keywords: | c++-lambda, ice-on-valid-code, rejects-valid |
| Version: | 10.0 | ||
| Target Milestone: | --- | ||
| See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102693 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93689 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 |
||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2024-04-15 00:00:00 | |
| Bug Depends on: | |||
| Bug Blocks: | 114840, 54367 | ||
Started to ICE with r9-6733-g03bed1538f8c71f0, it was rejected before that: pr98500.C:3:52: error: could not convert ‘<lambda closure object><lambda()>{}’ from ‘<lambda()>’ to ‘<lambda()>’ 3 | template<template<auto=[]{}> class H = X, class = H<>> | ^ pr98500.C:9:24: error: template argument 2 is invalid 9 | static_assert(sizeof(A<>)); | ^ Confirmed. I've triggered this without a template template parameter:
#include <type_traits>
template<auto unique = [] {}>
struct unique_empty_type { };
template<bool IsPresent, typename T>
using maybe_present = std::conditional_t<IsPresent, T, unique_empty_type<>>;
using empty = maybe_present<false, int>;
Godbolt link: https://godbolt.org/z/hf9csv8ne
Upon instantiating `empty`, an ICE is thrown. To me this seems like the same bug.
*** Bug 109978 has been marked as a duplicate of this bug. *** (In reply to friedkeenan from comment #3) > I've triggered this without a template template parameter: Note the testcase in comment #0 still ICEs while the testcase in comment #3 was fixed for GCC 14 by the recent lambda template patches. Now even comment #0 compiles fine. Fixed by bug 116567 I think. |
The following causes an ICE: template<auto> struct X {}; template<template<auto=[]{}> class H = X, class = H<>> struct A { }; static_assert(sizeof(A<>)); Message: <source>:5:24: internal compiler error: in tsubst, at cp/pt.c:15258 5 | template<template<auto=[]{}> class H = X, class = H<>> | ^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Occurs from GCC 9.1 to trunk, tested through compiler explorer: gcc 9.1: https://godbolt.org/z/ad7Gox gcc trunk: https://godbolt.org/z/K367rj Is probably related to the following tickets: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97610 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96908 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93595