mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
313afcfdab
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> |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
acinclude.m4 | ||
aclocal.m4 | ||
ChangeLog | ||
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 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 | ||
Makefile.am | ||
Makefile.in | ||
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.