https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101029
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- Created attachment 50985 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50985&action=edit test-case I see the following issue when not using an optimization level: $ g++ gcc_issue.cc -c gcc_issue.cc: In instantiation of ‘struct is_default_constructible<int>’: gcc_issue.cc:10:8: required from ‘struct __and_<is_default_constructible<int>, int, int>’ gcc_issue.cc:29:57: required by substitution of ‘template<class _U1, class _U2, typename enable_if<__and_<is_default_constructible<_U1>, _U2, int>::valuebool>::type <anonymous> > pair::pair() [with _U1 = int; _U2 = int; typename enable_if<__and_<is_default_constructible<_U1>, _U2, int>::valuebool>::type <anonymous> = <missing>]’ :126:31: required from here gcc_issue.cc:18:43: error: non-constant condition for static assertion 18 | static_assert(__is_complete_or_unbounded(_Tp{})); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ gcc_issue.cc:18:43: in ‘constexpr’ expansion of ‘__is_complete_or_unbounded<int>(0).integral_constant<1>::operator integral_constant<1>::value_type()’ gcc_issue.cc:18:43: internal compiler error: in cxx_eval_call_expression, at cp/constexpr.c:2701 0x65e879 cxx_eval_call_expression /home/marxin/Programming/gcc/gcc/cp/constexpr.c:2701 0x9a0489 cxx_eval_constant_expression /home/marxin/Programming/gcc/gcc/cp/constexpr.c:6232 0x9acc6d cxx_eval_binary_expression /home/marxin/Programming/gcc/gcc/cp/constexpr.c:3187 0x99f86a cxx_eval_constant_expression /home/marxin/Programming/gcc/gcc/cp/constexpr.c:6590 0x9a3f47 cxx_eval_outermost_constant_expr /home/marxin/Programming/gcc/gcc/cp/constexpr.c:7264 0xb955e9 finish_static_assert(tree_node*, tree_node*, unsigned int, bool, bool) /home/marxin/Programming/gcc/gcc/cp/semantics.c:10306 0xb55ec3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marxin/Programming/gcc/gcc/cp/pt.c:18644 0xb55ec3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marxin/Programming/gcc/gcc/cp/pt.c:18096 0xb710e9 instantiate_class_template_1 /home/marxin/Programming/gcc/gcc/cp/pt.c:12009 0xb710e9 instantiate_class_template(tree_node*) /home/marxin/Programming/gcc/gcc/cp/pt.c:12268 0xbbfe17 complete_type(tree_node*) /home/marxin/Programming/gcc/gcc/cp/typeck.c:143 0xbbfe17 complete_type(tree_node*) /home/marxin/Programming/gcc/gcc/cp/typeck.c:111 0xb7d116 lookup_member(tree_node*, tree_node*, int, bool, int, access_failure_info*) /home/marxin/Programming/gcc/gcc/cp/search.c:1148 0xabbe97 lookup_qualified_name(tree_node*, tree_node*, LOOK_want, bool) /home/marxin/Programming/gcc/gcc/cp/name-lookup.c:7113 0xb366f9 tsubst_qualified_id /home/marxin/Programming/gcc/gcc/cp/pt.c:16364 0xb3889b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marxin/Programming/gcc/gcc/cp/pt.c:19839 0xb54186 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marxin/Programming/gcc/gcc/cp/pt.c:19082 0xb54186 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marxin/Programming/gcc/gcc/cp/pt.c:18096 0xb5bf55 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) /home/marxin/Programming/gcc/gcc/cp/pt.c:12286 0xb5bf55 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) /home/marxin/Programming/gcc/gcc/cp/pt.c:12274 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. while -O is fine: $ g++ gcc_issue.cc -c -O