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> |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.