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)
commit74f02347ca163e6d7bbd737ec8c3511f4185f7ea
treebd95e32e2a83a992ae0acf3ddb3dee853d03af3f
parent9bce1e7553b4cd368306a2e1d0631fe7c99ad101
PR13403 (+duplicates): implement C++ DR1310 (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.

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