]> granicus.if.org Git - clang/commit
PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 19 Jan 2017 21:00:13 +0000 (21:00 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 19 Jan 2017 21:00:13 +0000 (21:00 +0000)
commita669043d2b89421b00d32aa819cb4e93e23560d6
tree774828ed8bbb439941ecd8bb54f8c3496aca0303
parent103c86b73b9b22adf7932a7e67ba645e38800c0d
PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).

Under this defect resolution, the injected-class-name of a class or class
template cannot be used except in very limited circumstances (when declaring a
constructor, in a nested-name-specifier, in a base-specifier, or in an
elaborated-type-specifier). This is apparently done to make parsing easier, but
it's a pain for us since we don't know whether a template-id using the
injected-class-name is valid at the point when we annotate it (we don't yet
know whether the template-id will become part of an elaborated-type-specifier).

As a tentative resolution to a perceived language defect, mem-initializer-ids
are added to the list of exceptions here (they generally follow the same rules
as base-specifiers).

When the reference to the injected-class-name uses the 'typename' or 'template'
keywords, we permit it to be used to name a type or template as an extension;
other compilers also accept some cases in this area. There are also a couple of
corner cases with dependent template names that we do not yet diagnose, but
which will also get this treatment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292518 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/AST/ASTContext.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseTemplate.cpp
lib/Parse/Parser.cpp
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaTemplate.cpp
test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
test/CXX/drs/dr13xx.cpp
test/CXX/drs/dr1xx.cpp
test/Driver/response-file.c
test/Index/annotate-nested-name-specifier.cpp
test/Parser/cxx0x-ambig.cpp
test/SemaTemplate/injected-class-name.cpp
test/SemaTemplate/instantiate-enum.cpp
test/SemaTemplate/instantiate-member-class.cpp
test/SemaTemplate/ms-sizeof-missing-typename.cpp
www/cxx_dr_status.html