gcc/libstdc++-v3
Patrick Palka 313afcfdab c++: diagnose failed qualified lookup into current inst
When the scope of a qualified name is the current instantiation, and
qualified lookup finds nothing at template definition time, then we
know it'll find nothing at instantiation time (unless the current
instantiation has dependent bases).  So such qualified name lookup
failure can be diagnosed ahead of time as per [temp.res.general]/6.

This patch implements that, for qualified names of the form (where
the current instantiation is A<T>):

  this->non_existent
  a.non_existent
  A::non_existent
  typename A::non_existent

It turns out we already optimistically attempt qualified lookup of
seemingly every qualified name, even when it's dependently scoped, and
then suppress issuing a lookup failure diagnostic after the fact.
So implementing this is mostly a matter of restricting the diagnostic
suppression to "dependentish" scopes (i.e. dependent scopes or the
current instantiation with dependent bases), rather than suppressing
for any dependently-typed scope as we currently do.

The cp_parser_conversion_function_id change is needed to avoid regressing
lookup/using8.C:

  using A<T>::operator typename A<T>::Nested*;

When looking up A<T>::Nested we consider it not dependently scoped since
we entered A<T> from cp_parser_conversion_function_id earlier.   But this
A<T> is the implicit instantiation A<T> not the primary template type A<T>,
and so the lookup fails which we now diagnose.  This patch works around
this by not entering the template scope of a qualified conversion
function-id in this case, i.e. if we're in an expression vs declaration
context, by seeing if the type already went through finish_template_type
with entering_scope=true.

gcc/cp/ChangeLog:

	* decl.cc (make_typename_type): Restrict name lookup failure
	punting to dependentish_scope_p instead of dependent_type_p.
	* error.cc (qualified_name_lookup_error): Improve diagnostic
	when the scope is the current instantiation.
	* parser.cc (cp_parser_diagnose_invalid_type_name): Likewise.
	(cp_parser_conversion_function_id): Don't call push_scope on
	a template scope unless we're in a declaration context.
	(cp_parser_lookup_name): Restrict name lookup failure
	punting to dependentish_scope_p instead of depedent_type_p.
	* semantics.cc (finish_id_expression_1): Likewise.
	* typeck.cc (finish_class_member_access_expr): Likewise.

libstdc++-v3/ChangeLog:

	* include/experimental/socket
	(basic_socket_iostream::basic_socket_iostream): Fix typo.
	* include/tr2/dynamic_bitset
	(__dynamic_bitset_base::_M_is_proper_subset_of): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alignas18.C: Expect name lookup error for U::X.
	* g++.dg/cpp0x/forw_enum13.C: Expect name lookup error for
	D3::A and D4<T>::A.
	* g++.dg/parse/access13.C: Declare A::E::V to avoid name lookup
	failure and preserve intent of the test.
	* g++.dg/parse/enum11.C: Expect extra errors, matching the
	non-template case.
	* g++.dg/template/crash123.C: Avoid name lookup failure to
	preserve intent of the test.
	* g++.dg/template/crash124.C: Likewise.
	* g++.dg/template/crash7.C: Adjust expected diagnostics.
	* g++.dg/template/dtor6.C: Declare A::~A() to avoid name lookup
	failure and preserve intent of the test.
	* g++.dg/template/error22.C: Adjust expected diagnostics.
	* g++.dg/template/static30.C: Avoid name lookup failure to
	preserve intent of the test.
	* g++.old-deja/g++.other/decl5.C: Adjust expected diagnostics.
	* g++.dg/template/non-dependent34.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2024-07-17 20:54:14 -04:00
..
config libstdc++: Fix std::codecvt<wchar_t, char, mbstate_t> for empty dest [PR37475] 2024-06-27 12:02:17 +01:00
doc libstdc++: Switch gcc.gnu.org links to https 2024-07-12 00:03:18 +02:00
include c++: diagnose failed qualified lookup into current inst 2024-07-17 20:54:14 -04:00
libsupc++ libstdc++: Make std::type_info::operator== always_inline for C++23 [PR110572] 2024-06-14 15:24:14 +01:00
po Update copyright years. 2024-01-03 12:19:35 +01:00
python libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318] 2024-01-17 11:49:11 +00:00
scripts libstdc++: Add script to update docs for a new release branch 2024-06-26 21:15:14 +01:00
src libstdc++: Minor optimization for std::locale::encoding() 2024-07-10 22:05:22 +01:00
testsuite [libstdc++] [testsuite] require dfprt on some tests 2024-07-12 05:42:19 -03:00
acinclude.m4 libstdc++: detect DLLs on windows with <stacktrace> 2024-05-17 14:45:19 +01:00
aclocal.m4
ChangeLog Daily bump. 2024-07-13 00:17:42 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-2021
ChangeLog-2022
ChangeLog-2023 Rotate ChangeLog files. 2024-01-03 11:29:39 +01:00
config.h.in libstdc++: detect DLLs on windows with <stacktrace> 2024-05-17 14:45:19 +01:00
configure [libstdc++-v3] [rtems] enable filesystem support 2024-05-30 04:01:15 -03:00
configure.ac [libstdc++-v3] [rtems] enable filesystem support 2024-05-30 04:01:15 -03:00
configure.host Fix up duplicated words mostly in comments, part 1 2024-04-02 13:39:11 +02:00
crossconfig.m4
fragment.am
linkage.m4 libstdc++: Remove handling for underscore-prefixed libm functions [PR111638] 2023-11-11 00:41:08 +00:00
Makefile.am Update copyright years. 2024-01-03 12:19:35 +01:00
Makefile.in Allow overriding EXPECT 2023-12-22 10:24:56 +00:00
README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.