Skip to content

ICE segfault on static_assert and instantiation constrained by concept with lambda NTTPs #161467

@Eczbek

Description

@Eczbek

https://godbolt.org/z/YEh68rqea

#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"



template<typename T>
using type = T;

template<typename T>
struct wrap_type {
	using type = T;
};

#define MAKE_VALUE(...) ([]<typename... $> { return __VA_ARGS__; })
#define MAKE_TYPE(...) MAKE_VALUE(wrap_type<__VA_ARGS__>())

// #define LIFT_VALUE(...) MAKE_VALUE(__VA_ARGS__<$...>)
#define LIFT_TYPE(...) MAKE_TYPE(__VA_ARGS__<$...>)

#define GET_VALUE(_name, ...) _name.template operator()<__VA_ARGS__>()
#define GET_TYPE(_name, ...) typename decltype(GET_VALUE(_name, __VA_ARGS__))::type



template<typename T, auto pred, auto proj, typename... Us>
concept make_concept = GET_VALUE(pred, GET_TYPE(proj, T), GET_TYPE(proj, Us)...);

constexpr auto is_same = MAKE_VALUE(requires (type<int(wrap_type<$...[0]>)>& f) {
	f(wrap_type<$...[1]>());
});

template<typename... Ts>
requires(sizeof...(Ts) == 1)
using add_cv = volatile const Ts...[0];



static_assert(make_concept<const int, is_same, LIFT_TYPE(add_cv), int>);

template<make_concept<is_same, LIFT_TYPE(add_cv), int>>
int x;

int main() {
	x<const int>;
}
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++26 <source>
1.	<source>:43:14: current parser token ';'
2.	<source>:42:12: parsing function body 'main'
3.	<source>:42:12: in compound statement ('{}')
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrash-on-invalid

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions