https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86441
Boris Kolpackov <boris at kolpackov dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|8.1.0 |10.1.0 --- Comment #2 from Boris Kolpackov <boris at kolpackov dot net> --- I am running into what I believe is the same issue with GCC 10.1.0 and a static_assert in shared_ptr's default ctor. Here is the code: #include <memory> struct object1 { }; struct object2 { std::shared_ptr<object1> o1; }; If a plugin calls locate_ctor() for object2, it ends up with the following error: In file included from /usr/local/gcc10/include/c++/10.1.0/bits/move.h:57, from /usr/local/gcc10/include/c++/10.1.0/bits/stl_pair.h:59, from /usr/local/gcc10/include/c++/10.1.0/bits/stl_algobase.h:64, from /usr/local/gcc10/include/c++/10.1.0/bits/char_traits.h:39, from /usr/local/gcc10/include/c++/10.1.0/string:40, from <standard-odb-prologue>:7: /usr/local/gcc10/include/c++/10.1.0/type_traits: In instantiation of ‘struct std::is_default_constructible<int>’: /usr/local/gcc10/include/c++/10.1.0/type_traits:143:12: required from ‘struct std::__and_<std::is_default_constructible<int>, std::is_default_constructible<int>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<int>, std::__is_implicitly_default_constructible<int> > > >’ /usr/local/gcc10/include/c++/10.1.0/bits/stl_pair.h:244:59: required by substitution of ‘template<class _U1, class _U2, typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_Dp>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> > constexpr std::pair<int, int>::pair() [with _U1 = int; _U2 = int; typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_Dp>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> = <missing>]’ test3.hxx:47:31: required from here /usr/local/gcc10/include/c++/10.1.0/type_traits:918:52: error: non-constant condition for static assertion 918 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/gcc10/include/c++/10.1.0/type_traits:918: confused by earlier errors, bailing out The stack trace for the same invocation (obtained with -dH) is as follows: #0 0x00007f8843fc4428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x00007f8843fc602a in __GI_abort () at abort.c:89 #2 0x000000000229fc95 in real_abort () at ../../gcc-10.1.0/gcc/diagnostic.c:1911 #3 0x000000000229baf3 in diagnostic_action_after_output (context=0x332c5e0 <global_diagnostic_context>, diag_kind=DK_ERROR) at ../../gcc-10.1.0/gcc/diagnostic.c:564 #4 0x000000000229d1fb in diagnostic_report_diagnostic (context=0x332c5e0 <global_diagnostic_context>, diagnostic=0x7ffd503c5f20) at ../../gcc-10.1.0/gcc/diagnostic.c:1179 #5 0x000000000229d7bb in diagnostic_impl (richloc=0x7ffd503c5fb0, metadata=0x0, opt=-1, gmsgid=0x2390648 "non-constant condition for static assertion", ap=0x7ffd503c5f98, kind=DK_ERROR) at ../../gcc-10.1.0/gcc/diagnostic.c:1316 #6 0x000000000229ed0d in error (gmsgid=0x2390648 "non-constant condition for static assertion") at ../../gcc-10.1.0/gcc/diagnostic.c:1612 #7 0x0000000000b2445a in finish_static_assert (condition=0x7f883e0178c0, message=0x7f8841d1cbb0, location=2147484459, member_p=true) at ../../gcc-10.1.0/gcc/cp/semantics.c:9699 #8 0x0000000000ac5f33 in instantiate_class_template_1 (type=0x7f883e030348) at ../../gcc-10.1.0/gcc/cp/pt.c:11823 #9 0x0000000000ac66e2 in instantiate_class_template (type=0x7f883e030348) at ../../gcc-10.1.0/gcc/cp/pt.c:12101 #10 0x0000000000b46487 in complete_type (type=0x7f883e030348) at ../../gcc-10.1.0/gcc/cp/typeck.c:137 #11 0x0000000000b04bf7 in lookup_member (xbasetype=0x0, name=0x7f8843a89040, protect=2, want_type=false, complain=3, afi=0x0) at ../../gcc-10.1.0/gcc/cp/search.c:1129 #12 0x0000000000a39487 in lookup_qualified_name (scope=0x7f883e030348, name=0x7f8843a89040, prefer_type=0, complain=false, find_hidden=false) at ../../gcc-10.1.0/gcc/cp/name-lookup.c:6023 #13 0x0000000000ad18bf in tsubst_qualified_id (qualified_id=0x7f8841db2af0, args=0x7f883e0177e0, complain=1, in_decl=0x0, done=true, address_p=false) at ../../gcc-10.1.0/gcc/cp/pt.c:16158 #14 0x0000000000adc40c in tsubst_copy_and_build (t=0x7f8841db2af0, args=0x7f883e0177e0, complain=1, in_decl=0x0, function_p=false, integral_constant_expression_p=true) at ../../gcc-10.1.0/gcc/cp/pt.c:19449 #15 0x0000000000ada2d1 in tsubst_expr (t=0x7f8841db2af0, args=0x7f883e0177e0, complain=1, in_decl=0x0, integral_constant_expression_p=true) at ../../gcc-10.1.0/gcc/cp/pt.c:18738 #16 0x0000000000ac678e in tsubst_template_arg (t=0x7f8841db2af0, args=0x7f883e0177e0, complain=1, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:12119 #17 0x0000000000ac8e09 in tsubst_template_args (t=0x7f8841da56c0, args=0x7f883e0177e0, complain=1, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:13168 #18 0x0000000000ac9672 in tsubst_aggr_type (t=0x7f8841db3e70, args=0x7f883e0177e0, complain=1, in_decl=0x0, entering_scope=1) at ../../gcc-10.1.0/gcc/cp/pt.c:13371 #19 0x0000000000ad09d5 in tsubst (t=0x7f8841db3f18, args=0x7f883e0177e0, complain=1, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:15786 #20 0x0000000000ac587b in instantiate_class_template_1 (type=0x7f883e030690) at ../../gcc-10.1.0/gcc/cp/pt.c:11689 #21 0x0000000000ac66e2 in instantiate_class_template (type=0x7f883e030690) at ../../gcc-10.1.0/gcc/cp/pt.c:12101 #22 0x0000000000b46487 in complete_type (type=0x7f883e030690) at ../../gcc-10.1.0/gcc/cp/typeck.c:137 #23 0x0000000000b04bf7 in lookup_member (xbasetype=0x0, name=0x7f8843a89040, protect=2, want_type=false, complain=3, afi=0x0) at ../../gcc-10.1.0/gcc/cp/search.c:1129 #24 0x0000000000a39487 in lookup_qualified_name (scope=0x7f883e030690, name=0x7f8843a89040, prefer_type=0, complain=false, find_hidden=false) at ../../gcc-10.1.0/gcc/cp/name-lookup.c:6023 #25 0x0000000000ad18bf in tsubst_qualified_id (qualified_id=0x7f883fb412f8, args=0x7f883e4e6db0, complain=0, in_decl=0x0, done=true, address_p=false) at ../../gcc-10.1.0/gcc/cp/pt.c:16158 #26 0x0000000000adc40c in tsubst_copy_and_build (t=0x7f883fb412f8, args=0x7f883e4e6db0, complain=0, in_decl=0x0, function_p=false, integral_constant_expression_p=true) at ../../gcc-10.1.0/gcc/cp/pt.c:19449 #27 0x0000000000ada2d1 in tsubst_expr (t=0x7f883fb412f8, args=0x7f883e4e6db0, complain=0, in_decl=0x0, integral_constant_expression_p=true) at ../../gcc-10.1.0/gcc/cp/pt.c:18738 #28 0x0000000000ac678e in tsubst_template_arg (t=0x7f883fb412f8, args=0x7f883e4e6db0, complain=0, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:12119 #29 0x0000000000ac8e09 in tsubst_template_args (t=0x7f883fb412d0, args=0x7f883e4e6db0, complain=0, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:13168 #30 0x0000000000ac9672 in tsubst_aggr_type (t=0x7f883fb40888, args=0x7f883e4e6db0, complain=0, in_decl=0x0, entering_scope=1) at ../../gcc-10.1.0/gcc/cp/pt.c:13371 #31 0x0000000000ad09d5 in tsubst (t=0x7f883fb40930, args=0x7f883e4e6db0, complain=0, in_decl=0x0) at ../../gcc-10.1.0/gcc/cp/pt.c:15786 #32 0x0000000000ae31f5 in type_unification_real (tparms=0x7f883fb26fc0, full_targs=0x7f883e4e6db0, xparms=0x7f8843a838e8, xargs=0x7ffd503c7860, xnargs=0, subr=0, strict=DEDUCE_CALL, checks=0x7ffd503c77c8, explain_p=false) at ../../gcc-10.1.0/gcc/cp/pt.c:21981 #33 0x0000000000ae1831 in fn_type_unification (fn=0x7f883fb8db00, explicit_targs=0x0, targs=0x7f883e4e6db0, args=0x7ffd503c7860, nargs=0, return_type=0x0, strict=DEDUCE_CALL, flags=32768, convs=0x52fd9d0, explain_p=false, decltype_p=false) at ../../gcc-10.1.0/gcc/cp/pt.c:21199 #34 0x00000000008f92f1 in add_template_candidate_real (candidates=0x7ffd503c7b38, tmpl=0x7f883fb8db00, ctype=0x7f883fb37738, explicit_targs=0x0, first_arg=0x7f883e025e20, arglist=0x7f883e21ecd0, return_type=0x0, access_path=0x7f883fa9aa28, conversion_path=0x7f883fa9aa28, flags=32768, obj=0x0, strict=DEDUCE_CALL, complain=0) at ../../gcc-10.1.0/gcc/cp/call.c:3415 #35 0x00000000008f95ef in add_template_candidate (candidates=0x7ffd503c7b38, tmpl=0x7f883fb8db00, ctype=0x7f883fb37738, explicit_targs=0x0, first_arg=0x7f883e025e20, arglist=0x7f883e21ecd0, return_type=0x0, access_path=0x7f883fa9aa28, conversion_path=0x7f883fa9aa28, flags=32768, strict=DEDUCE_CALL, complain=0) at ../../gcc-10.1.0/gcc/cp/call.c:3503 #36 0x00000000008ffb61 in add_candidates (fns=0x7f883fb89860, first_arg=0x7f883e025e20, args=0x7f883e21ecd0, return_type=0x0, explicit_targs=0x0, template_only=false, conversion_path=0x7f883fa9aa28, access_path=0x7f883fa9aa28, flags=32768, candidates=0x7ffd503c7b38, complain=0) at ../../gcc-10.1.0/gcc/cp/call.c:5853 #37 0x000000000090b824 in build_new_method_call_1 (instance=0x7f883e025e20, fns=0x7f883fb89860, args=0x7ffd503c7ca0, conversion_path=0x7f883fa9aa28, flags=32768, fn_p=0x7ffd503c7cb0, complain=0) at ../../gcc-10.1.0/gcc/cp/call.c:10220 #38 0x000000000090c25b in build_new_method_call (instance=0x7f883e025e20, fns=0x7f883e4c83f0, args=0x7ffd503c7ca0, conversion_path=0x7f883fa9aa28, flags=32768, fn_p=0x7ffd503c7cb0, complain=0) at ../../gcc-10.1.0/gcc/cp/call.c:10429 #39 0x0000000000a26154 in locate_fn_flags (type=0x7f883fb37738, name=0x7f8843a88900, argtype=0x0, flags=32768, complain=0) at ../../gcc-10.1.0/gcc/cp/method.c:1650 #40 0x0000000000a2622e in locate_ctor (type=0x7f883fb37738) at ../../gcc-10.1.0/gcc/cp/method.c:1678 #41 ... <plugin call stack here (not relevant)> #66 ... #67 0x00000000011f7c46 in invoke_plugin_callbacks_full (event=20, gcc_data=0x7ffd503ca93b) at ../../gcc-10.1.0/gcc/plugin.c:588 #68 0x00000000011e0883 in invoke_plugin_callbacks (event=20, gcc_data=0x7ffd503ca93b) at ../../gcc-10.1.0/gcc/plugin.h:191 #69 0x00000000011f2d4f in execute_one_pass (pass=0x522ae30) at ../../gcc-10.1.0/gcc/passes.c:2453 #70 0x00000000011f3eaf in execute_ipa_pass_list (pass=0x522ae30) at ../../gcc-10.1.0/gcc/passes.c:2929 #71 0x0000000000ced528 in ipa_passes () at ../../gcc-10.1.0/gcc/cgraphunit.c:2620 #72 0x0000000000ced940 in symbol_table::compile (this=0x7f8843a72100) at ../../gcc-10.1.0/gcc/cgraphunit.c:2755 #73 0x0000000000cedf10 in symbol_table::finalize_compilation_unit (this=0x7f8843a72100) at ../../gcc-10.1.0/gcc/cgraphunit.c:3002 #74 0x000000000134f973 in compile_file () at ../../gcc-10.1.0/gcc/toplev.c:483 #75 0x0000000001352b89 in do_compile () at ../../gcc-10.1.0/gcc/toplev.c:2273 #76 0x0000000001352e96 in toplev::main (this=0x7ffd503cab36, argc=44, argv=0x7ffd503cac38) at ../../gcc-10.1.0/gcc/toplev.c:2412 #77 0x000000000227109b in main (argc=44, argv=0x7ffd503cac38) at ../../gcc-10.1.0/gcc/main.c:39 Looking at the bottom of this stack (specifically, finalize_compilation_unit()) makes me wonder if the door on instantiating templates or completing lazy ctor declarations is closed at this stage? Again, I would be happy to do any required leg work on this.