mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-01 20:46:06 +00:00

This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
27 lines
948 B
C++
27 lines
948 B
C++
// RUN: %clang_cc1 -verify %s
|
|
// RUN: %clang_cc1 -verify %s -std=c++98
|
|
// RUN: %clang_cc1 -verify %s -std=c++11
|
|
// RUN: %clang_cc1 -verify %s -std=c++1z
|
|
|
|
// PR25946
|
|
// We had an off-by-one error in an assertion when annotating A<int> below. Our
|
|
// error recovery checks if A<int> is a constructor declarator, and opens a
|
|
// TentativeParsingAction. Then we attempt to annotate the token at the exact
|
|
// position that we want to possibly backtrack to, and this used to crash.
|
|
|
|
template <typename T> class A {};
|
|
|
|
// expected-error@+1 {{expected '{' after base class list}}
|
|
template <typename T> class B : T // not ',' or '{'
|
|
#if __cplusplus < 201103L
|
|
// expected-error@+8 {{expected ';' after top level declarator}}
|
|
#endif
|
|
#if __cplusplus <= 201402L
|
|
// expected-error@+5 {{C++ requires a type specifier for all declarations}}
|
|
#else
|
|
// expected-error@+3 {{expected unqualified-id}}
|
|
#endif
|
|
// expected-error@+1 {{expected ';' after class}}
|
|
A<int> {
|
|
};
|