gcc/libstdc++-v3/testsuite/20_util
Patrick Palka 92bed03609 c++: Improve access checking inside templates [PR41437]
This patch generalizes our existing functionality for deferring access
checking of typedefs when parsing a function or class template to now
defer all kinds of access checks until template instantiation time,
including member function and member object accesses.

Since all access checks eventually go through enforce_access, the main
component of this patch is new handling inside enforce_access to defer
the current access check if we're inside a template.  The bulk of the
rest of the patch consists of removing now-unneeded code pertaining to
suppressing access checks inside templates or pertaining to
typedef-specific access handling.  Renamings and other changes with no
functional impact have been split off into the followup patch.

gcc/cp/ChangeLog:

	PR c++/41437
	PR c++/47346
	* call.c (enforce_access): Move to semantics.c.
	* cp-tree.h (enforce_access): Delete.
	(get_types_needing_access_check): Delete.
	(add_typedef_to_current_template_for_access_check): Delete.
	* decl.c (make_typename_type): Adjust accordingly.  Use
	check_accessibility_of_qualified_id instead of directly using
	perform_or_defer_access_check.
	* parser.c (cp_parser_template_declaration_after_parameters):
	Don't push a dk_no_check access state when parsing a template.
	* pt.c (get_types_needing_access_check): Delete.
	(append_type_to_template_for_access_check_1): Delete.
	(perform_typedefs_access_check): Adjust.  If type_decl is a
	FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
	tsubst_copy instead of tsubst to substitute into type_decl so
	that we substitute into the DECL_CONTEXT of a FIELD_DECL.
	(append_type_to_template_for_access_check): Delete.
	* search.c (accessible_p): Remove the processing_template_decl
	early exit.
	* semantics.c (enforce_access): Moved from call.c.  If we're
	parsing a template and the access check failed, add the check to
	TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
	(perform_or_defer_access_check): Adjust comment.
	(add_typedef_to_current_template_for_access_check): Delete.
	(check_accessibility_of_qualified_id):  Adjust accordingly.
	Exit early if the scope is dependent.

gcc/testsuite/ChangeLog:

	PR c++/41437
	PR c++/47346
	* g++.dg/cpp2a/concepts-using2.C: Adjust.
	* g++.dg/lto/20081219_1.C: Adjust.
	* g++.dg/lto/20091002-1_0.C: Adjust.
	* g++.dg/lto/pr65475c_0.C: Adjust.
	* g++.dg/opt/dump1.C: Adjust.
	* g++.dg/other/pr53574.C: Adjust.
	* g++.dg/template/access30.C: New test.
	* g++.dg/template/access31.C: New test.
	* g++.dg/wrappers/wrapper-around-type-pack-expansion.C: Adjust.

libstdc++-v3/ChangeLog:

	PR libstdc++/94003
	* testsuite/20_util/is_constructible/94003.cc: New test.
2020-06-16 08:21:33 -04:00
..
add_const
add_cv
add_lvalue_reference
add_pointer
add_rvalue_reference
add_volatile
addressof
align
aligned_storage
aligned_union
alignment_of
allocator libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510) 2020-04-30 16:01:43 +01:00
allocator_traits Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
any libstdc++: Fix constructor constraints for std::any (PR 90415) 2020-04-24 00:54:20 +01:00
as_const
assume_aligned
auto_ptr
bad_function_call
bind x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
bool_constant
common_reference/requirements
common_type/requirements
conditional/requirements
decay/requirements
declval/requirements
default_delete libstdc++: Fix failing tests 2020-06-08 21:34:46 +01:00
duration libstdc++: Add comparison operators to <chrono> types 2020-04-18 00:47:45 +01:00
duration_cast
enable_if/requirements
enable_shared_from_this
exchange libstdc++: Do not define __cpp_lib_constexpr_algorithms in <utility> 2020-04-22 22:54:35 +01:00
extent
forward
from_chars libstdc++: Add comparison operators to <charconv> result types 2020-04-08 16:16:10 +01:00
function
function_objects libstdc++: Fixes for feature test macros (PR 91480) 2020-04-28 23:40:18 +01:00
has_unique_object_representations
has_virtual_destructor
hash
headers
in_place
integer_comparisons
integer_sequence
integral_constant
is_abstract
is_aggregate
is_arithmetic
is_array
is_assignable
is_base_of
is_bounded_array
is_class
is_complete_or_unbounded
is_compound
is_const
is_constant_evaluated
is_constructible c++: Improve access checking inside templates [PR41437] 2020-06-16 08:21:33 -04:00
is_convertible
is_copy_assignable
is_copy_constructible
is_default_constructible
is_destructible
is_empty
is_enum
is_final
is_floating_point
is_function x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_fundamental
is_implicitly_default_constructible
is_integral
is_invocable
is_literal_type
is_lvalue_reference
is_member_function_pointer x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_member_object_pointer
is_member_pointer
is_move_assignable
is_move_constructible
is_nothrow_assignable
is_nothrow_constructible libstdc++: Support arrays in std::is_nothrow_constructible (PR 94149) 2020-04-21 22:18:51 +01:00
is_nothrow_convertible
is_nothrow_copy_assignable
is_nothrow_copy_constructible
is_nothrow_default_constructible
is_nothrow_destructible
is_nothrow_invocable
is_nothrow_move_assignable
is_nothrow_move_constructible
is_nothrow_swappable
is_nothrow_swappable_with
is_null_pointer
is_object x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_pod
is_pointer
is_polymorphic
is_reference
is_rvalue_reference
is_same
is_scalar
is_signed
is_standard_layout
is_swappable
is_swappable_with
is_trivial
is_trivially_assignable
is_trivially_constructible
is_trivially_copy_assignable
is_trivially_copy_constructible
is_trivially_copyable
is_trivially_default_constructible
is_trivially_destructible
is_trivially_move_assignable
is_trivially_move_constructible
is_unbounded_array
is_union
is_unsigned
is_void
is_volatile
logical_traits
make_signed/requirements
make_unsigned/requirements
memory_resource
monotonic_buffer_resource
move
move_if_noexcept
nonesuch
optional libstdc++: Define std::bad_optional_access constructor as defaulted 2020-06-09 22:14:43 +01:00
owner_less
pair c++: Explain fn template argument type/value mismatches [PR66439] 2020-05-18 23:50:14 -04:00
pointer_safety
pointer_traits
polymorphic_allocator
rank
ratio
raw_storage_iterator
reference_wrapper
remove_all_extents
remove_const
remove_cv
remove_cvref
remove_extent
remove_pointer
remove_reference
remove_volatile
result_of
scoped_allocator
shared_ptr libstdc++: Add comparison operators to std::shared_ptr (PR 94562) 2020-04-14 21:54:55 +01:00
specialized_algorithms libstdc++: Fix regression in std::_Construct (PR 94831) 2020-04-28 23:39:38 +01:00
steady_clock
synchronized_pool_resource libstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936) 2020-05-04 13:37:31 +01:00
system_clock
time_point libstdc++: Add comparison operators to <chrono> types 2020-04-18 00:47:45 +01:00
time_point_cast
to_address libstdc++: Add missing feature test macros 2020-04-22 22:54:34 +01:00
to_chars libstdc++: Add comparison operators to <charconv> result types 2020-04-08 16:16:10 +01:00
tuple c++: Explain fn template argument type/value mismatches [PR66439] 2020-05-18 23:50:14 -04:00
type_identity/requirements
typeindex libstdc++: Add spaceship operator to std::type_index 2020-04-15 19:47:47 +01:00
underlying_type/requirements
unique_ptr libstdc++: Implement operator<< for std::unique_ptr (LWG 2948) 2020-06-08 21:21:31 +01:00
unsynchronized_pool_resource libstdc++: Fix -Wunused-parameter warning in test 2020-04-16 08:44:10 +01:00
unwrap_reference
uses_allocator Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
variant Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
void_t
weak_ptr
rel_ops.cc
temporary_buffer.cc
variable_templates_for_traits.cc