gcc/libstdc++-v3/testsuite/20_util
Jason Merrill 87c2080b05 c++: Add -fimplicit-constexpr
With each successive C++ standard the restrictions on the use of the
constexpr keyword for functions get weaker and weaker; it recently occurred
to me that it is heading toward the same fate as the C register keyword,
which was once useful for optimization but became obsolete.  Similarly, it
seems to me that we should be able to just treat inlines as constexpr
functions and not make people add the extra keyword everywhere.

There were a lot of testcase changes needed; many disabling errors about
non-constexpr functions that are now constexpr, and many disabling implicit
constexpr so that the tests can check the same thing as before, whether
that's mangling or whatever.

gcc/c-family/ChangeLog:

	* c.opt: Add -fimplicit-constexpr.
	* c-cppbuiltin.c: Define __cpp_implicit_constexpr.
	* c-opts.c (c_common_post_options): Disable below C++14.

gcc/cp/ChangeLog:

	* cp-tree.h (struct lang_decl_fn): Add implicit_constexpr.
	(decl_implicit_constexpr_p): New.
	* class.c (type_maybe_constexpr_destructor): Use
	TYPE_HAS_TRIVIAL_DESTRUCTOR and maybe_constexpr_fn.
	(finalize_literal_type_property): Simplify.
	* constexpr.c (is_valid_constexpr_fn): Check for dtor.
	(maybe_save_constexpr_fundef): Try to set DECL_DECLARED_CONSTEXPR_P
	on inlines.
	(cxx_eval_call_expression): Use maybe_constexpr_fn.
	(maybe_constexpr_fn): Handle flag_implicit_constexpr.
	(var_in_maybe_constexpr_fn): Use maybe_constexpr_fn.
	(potential_constant_expression_1): Likewise.
	(decl_implicit_constexpr_p): New.
	* decl.c (validate_constexpr_redeclaration): Allow change with
	-fimplicit-constexpr.
	(grok_special_member_properties): Use maybe_constexpr_fn.
	* error.c (dump_function_decl): Don't print 'constexpr'
	if it's implicit.
	* Make-lang.in (check-c++-all): Update.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/to_address/1_neg.cc: Adjust error.
	* testsuite/26_numerics/random/concept.cc: Adjust asserts.

gcc/testsuite/ChangeLog:

	* lib/g++-dg.exp: Handle "impcx".
	* lib/target-supports.exp
	(check_effective_target_implicit_constexpr): New.
	* g++.dg/abi/abi-tag16.C:
	* g++.dg/abi/abi-tag18a.C:
	* g++.dg/abi/guard4.C:
	* g++.dg/abi/lambda-defarg1.C:
	* g++.dg/abi/mangle26.C:
	* g++.dg/cpp0x/constexpr-diag3.C:
	* g++.dg/cpp0x/constexpr-ex1.C:
	* g++.dg/cpp0x/constexpr-ice5.C:
	* g++.dg/cpp0x/constexpr-incomplete2.C:
	* g++.dg/cpp0x/constexpr-memfn1.C:
	* g++.dg/cpp0x/constexpr-neg3.C:
	* g++.dg/cpp0x/constexpr-specialization.C:
	* g++.dg/cpp0x/inh-ctor19.C:
	* g++.dg/cpp0x/inh-ctor30.C:
	* g++.dg/cpp0x/lambda/lambda-mangle3.C:
	* g++.dg/cpp0x/lambda/lambda-mangle5.C:
	* g++.dg/cpp1y/auto-fn12.C:
	* g++.dg/cpp1y/constexpr-loop5.C:
	* g++.dg/cpp1z/constexpr-lambda7.C:
	* g++.dg/cpp2a/constexpr-dtor3.C:
	* g++.dg/cpp2a/constexpr-new13.C:
	* g++.dg/cpp2a/constinit11.C:
	* g++.dg/cpp2a/constinit12.C:
	* g++.dg/cpp2a/constinit14.C:
	* g++.dg/cpp2a/constinit15.C:
	* g++.dg/cpp2a/spaceship-constexpr1.C:
	* g++.dg/cpp2a/spaceship-eq3.C:
	* g++.dg/cpp2a/udlit-class-nttp-neg2.C:
	* g++.dg/debug/dwarf2/auto1.C:
	* g++.dg/debug/dwarf2/cdtor-1.C:
	* g++.dg/debug/dwarf2/lambda1.C:
	* g++.dg/debug/dwarf2/pr54508.C:
	* g++.dg/debug/dwarf2/pubnames-2.C:
	* g++.dg/debug/dwarf2/pubnames-3.C:
	* g++.dg/ext/is_literal_type3.C:
	* g++.dg/ext/visibility/template7.C:
	* g++.dg/gcov/gcov-12.C:
	* g++.dg/gcov/gcov-2.C:
	* g++.dg/ipa/devirt-35.C:
	* g++.dg/ipa/devirt-36.C:
	* g++.dg/ipa/devirt-37.C:
	* g++.dg/ipa/devirt-44.C:
	* g++.dg/ipa/imm-devirt-1.C:
	* g++.dg/lookup/builtin5.C:
	* g++.dg/lto/inline-crossmodule-1_0.C:
	* g++.dg/modules/enum-1_a.C:
	* g++.dg/modules/fn-inline-1_c.C:
	* g++.dg/modules/pmf-1_b.C:
	* g++.dg/modules/used-1_c.C:
	* g++.dg/tls/thread_local11.C:
	* g++.dg/tls/thread_local11a.C:
	* g++.dg/tm/pr46653.C:
	* g++.dg/ubsan/pr70035.C:
	* g++.old-deja/g++.other/delete6.C:
	* g++.dg/modules/pmf-1_a.H:
	Adjust for implicit constexpr.
2021-11-15 18:50:07 -05:00
..
add_const Update copyright years. 2021-01-04 10:26:59 +01:00
add_cv Update copyright years. 2021-01-04 10:26:59 +01:00
add_lvalue_reference Update copyright years. 2021-01-04 10:26:59 +01:00
add_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
add_rvalue_reference Update copyright years. 2021-01-04 10:26:59 +01:00
add_volatile Update copyright years. 2021-01-04 10:26:59 +01:00
addressof libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
align Update copyright years. 2021-01-04 10:26:59 +01:00
aligned_storage Update copyright years. 2021-01-04 10:26:59 +01:00
aligned_union Update copyright years. 2021-01-04 10:26:59 +01:00
alignment_of Update copyright years. 2021-01-04 10:26:59 +01:00
allocator libstdc++: Add warnings for some C++23 deprecations 2021-06-09 10:32:43 +01:00
allocator_traits Update copyright years. 2021-01-04 10:26:59 +01:00
any libstdc++: Constrain std::make_any [PR102894] 2021-10-22 23:09:54 +01:00
as_const libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
assume_aligned Update copyright years. 2021-01-04 10:26:59 +01:00
auto_ptr Update copyright years. 2021-01-04 10:26:59 +01:00
bad_function_call Update copyright years. 2021-01-04 10:26:59 +01:00
bind libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
bool_constant libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
common_reference libstdc++: Fix common_reference for non-reference results [PR100894] 2021-06-14 21:17:53 +01:00
common_type/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
conditional/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
decay/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
declval/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
default_delete libstdc++: Fix 48631_neg test in _GLIBCXX_INLINE_VERSION mode 2021-09-28 22:09:48 +02:00
duration libstdc++: Implement ostream insertion for chrono::duration 2021-10-08 12:19:19 +01:00
duration_cast libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
enable_if/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
enable_shared_from_this libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
exchange libstdc++: Add conditional noexcept to std::exchange 2021-08-17 14:22:49 +01:00
extent Update copyright years. 2021-01-04 10:26:59 +01:00
forward libstdc++: Improve std::forward static assert message 2021-09-28 17:30:05 +01:00
from_chars libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
function libstdc++: Avoid a move in std::function construction (LWG 2447) 2021-08-27 00:12:54 +01:00
function_objects libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
has_unique_object_representations libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
has_virtual_destructor Update copyright years. 2021-01-04 10:26:59 +01:00
hash libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
headers libstdc++: Fix tests that fail in C++98 mode 2021-05-11 17:21:08 +01:00
in_place libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
integer_comparisons c++: instantiate less for constant folding 2021-10-14 21:40:11 -04:00
integer_sequence Update copyright years. 2021-01-04 10:26:59 +01:00
integral_constant Update copyright years. 2021-01-04 10:26:59 +01:00
invoke_result Update copyright years. 2021-01-04 10:26:59 +01:00
is_abstract Update copyright years. 2021-01-04 10:26:59 +01:00
is_aggregate libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_arithmetic libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_array Update copyright years. 2021-01-04 10:26:59 +01:00
is_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_base_of Update copyright years. 2021-01-04 10:26:59 +01:00
is_bounded_array Update copyright years. 2021-01-04 10:26:59 +01:00
is_class Update copyright years. 2021-01-04 10:26:59 +01:00
is_complete_or_unbounded Update copyright years. 2021-01-04 10:26:59 +01:00
is_compound libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_const Update copyright years. 2021-01-04 10:26:59 +01:00
is_constant_evaluated Update copyright years. 2021-01-04 10:26:59 +01:00
is_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_convertible Update copyright years. 2021-01-04 10:26:59 +01:00
is_copy_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_copy_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_default_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_destructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_empty Update copyright years. 2021-01-04 10:26:59 +01:00
is_enum Update copyright years. 2021-01-04 10:26:59 +01:00
is_final Update copyright years. 2021-01-04 10:26:59 +01:00
is_floating_point libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_function Update copyright years. 2021-01-04 10:26:59 +01:00
is_fundamental libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_implicitly_default_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_integral libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_invocable libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_layout_compatible libstdc++: Fix test for feature test macro 2021-10-14 09:08:01 +01:00
is_literal_type libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_lvalue_reference Update copyright years. 2021-01-04 10:26:59 +01:00
is_member_function_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
is_member_object_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
is_member_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
is_move_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_move_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_constructible libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_nothrow_convertible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_copy_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_copy_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_default_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_destructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_invocable libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_nothrow_move_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_move_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_nothrow_swappable libstdc++: Fix tests that use invalid types in ordered containers 2021-09-28 20:22:51 +01:00
is_nothrow_swappable_with libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_null_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
is_object Update copyright years. 2021-01-04 10:26:59 +01:00
is_pod Update copyright years. 2021-01-04 10:26:59 +01:00
is_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
is_pointer_interconvertible libstdc++: Add std::is_layout_compatible trait for C++20 2021-08-24 16:12:44 +01:00
is_polymorphic Update copyright years. 2021-01-04 10:26:59 +01:00
is_reference Update copyright years. 2021-01-04 10:26:59 +01:00
is_rvalue_reference Update copyright years. 2021-01-04 10:26:59 +01:00
is_same Update copyright years. 2021-01-04 10:26:59 +01:00
is_scalar Update copyright years. 2021-01-04 10:26:59 +01:00
is_scoped_enum libstdc++: Make std::is_scoped_enum work with incomplete types 2021-04-08 11:56:59 +01:00
is_signed libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_standard_layout Update copyright years. 2021-01-04 10:26:59 +01:00
is_swappable libstdc++: Fix tests that use invalid types in ordered containers 2021-09-28 20:22:51 +01:00
is_swappable_with libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
is_trivial Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_constructible libstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535] 2021-10-05 09:35:47 +01:00
is_trivially_copy_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_copy_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_copyable Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_default_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_destructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_move_assignable Update copyright years. 2021-01-04 10:26:59 +01:00
is_trivially_move_constructible Update copyright years. 2021-01-04 10:26:59 +01:00
is_unbounded_array Update copyright years. 2021-01-04 10:26:59 +01:00
is_union Update copyright years. 2021-01-04 10:26:59 +01:00
is_unsigned libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_void libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
is_volatile Update copyright years. 2021-01-04 10:26:59 +01:00
logical_traits libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
make_signed/requirements libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
make_unsigned/requirements libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
memory_resource libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
monotonic_buffer_resource libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
move Update copyright years. 2021-01-04 10:26:59 +01:00
move_if_noexcept Update copyright years. 2021-01-04 10:26:59 +01:00
move_only_function libstdc++: Fix mem-initializer in std::move_only_function [PR102825] 2021-10-19 11:50:46 +01:00
nonesuch Update copyright years. 2021-01-04 10:26:59 +01:00
optional libstdc++: Remove constraints from std::optional monadic ops [PR102863] 2021-10-21 01:23:22 +01:00
owner_less Update copyright years. 2021-01-04 10:26:59 +01:00
pair libstdc++: Add testsuite proc for testing deprecated features 2021-08-03 15:30:17 +01:00
pointer_safety libstdc++: Remove garbage collection support for C++23 [P2186R2] 2021-06-22 20:58:43 +01:00
pointer_traits Update copyright years. 2021-01-04 10:26:59 +01:00
polymorphic_allocator libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
rank Update copyright years. 2021-01-04 10:26:59 +01:00
ratio c++: Don't hide narrowing errors in system headers 2021-07-16 09:28:37 -04:00
raw_storage_iterator Update copyright years. 2021-01-04 10:26:59 +01:00
reference_wrapper libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
remove_all_extents Update copyright years. 2021-01-04 10:26:59 +01:00
remove_const Update copyright years. 2021-01-04 10:26:59 +01:00
remove_cv Update copyright years. 2021-01-04 10:26:59 +01:00
remove_cvref libstdc++: Fix definition of std::remove_cvref_t 2021-05-06 13:41:15 +01:00
remove_extent Update copyright years. 2021-01-04 10:26:59 +01:00
remove_pointer Update copyright years. 2021-01-04 10:26:59 +01:00
remove_reference Update copyright years. 2021-01-04 10:26:59 +01:00
remove_volatile Update copyright years. 2021-01-04 10:26:59 +01:00
result_of Update copyright years. 2021-01-04 10:26:59 +01:00
scoped_allocator libstdc++: Adjust expected errors in tests when compiled as C++20 2021-05-10 15:54:43 +01:00
shared_ptr libstdc++: Remove trailing whitespace in some tests 2021-08-03 15:30:36 +01:00
specialized_algorithms libstdc++: Remove c++20-specific dg-error directives in test 2021-09-23 16:07:39 +01:00
steady_clock Update copyright years. 2021-01-04 10:26:59 +01:00
synchronized_pool_resource libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
system_clock Update copyright years. 2021-01-04 10:26:59 +01:00
time_point libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
time_point_cast libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
to_address c++: Add -fimplicit-constexpr 2021-11-15 18:50:07 -05:00
to_chars libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
to_underlying libstdc++: Add std::to_underlying for C++23 2021-02-25 11:53:58 +00:00
tuple libstdc++: Optimize std::tuple_element and std::tuple_size_v 2021-11-04 18:14:50 +00:00
type_identity/requirements libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [PR98725] 2021-10-09 00:57:50 +01:00
typeindex Update copyright years. 2021-01-04 10:26:59 +01:00
underlying_type/requirements Update copyright years. 2021-01-04 10:26:59 +01:00
unique_ptr libstdc++: Add testsuite proc for testing deprecated features 2021-08-03 15:30:17 +01:00
unsynchronized_pool_resource libstdc++: Remove redundant -std=gnu++17 option from PMR tests 2021-05-10 16:22:53 +01:00
unwrap_reference Update copyright years. 2021-01-04 10:26:59 +01:00
uses_allocator libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
variant libstdc++: Fix handling of const types in std::variant [PR102912] 2021-11-04 09:36:09 +00:00
void_t libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
weak_ptr libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
rel_ops.cc libstdc++: Add [[nodiscard]] to iterators and related utilities 2021-08-04 12:54:28 +01:00
temporary_buffer.cc Update copyright years. 2021-01-04 10:26:59 +01:00
variable_templates_for_traits.cc libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00