llvm-capstone/clang/test/SemaTemplate
Emilia Dreamer 6acdf58919
[clang] Properly parse variable template requires clause in lambda
Since P0857, part of C++20, a *lambda-expression* can contain a
*requires-clause* after its *template-parameter-list*.

While support for this was added as part of
eccc734a69, one specific case isn't
handled properly, where the *requires-clause* consists of an
instantiation of a boolean variable template. This is due to a
diagnostic check which was written with the assumption that a
*requires-clause* can never be followed by a left parenthesis. This
assumption no longer holds for lambdas.

This diagnostic check would then attempt to perform a "recovery", but it
does so in a valid parse state, resulting in an invalid parse state
instead!

This patch adds a special case when parsing requires clauses of lambda
templates, to skip this diagnostic check.

Fixes https://github.com/llvm/llvm-project/issues/61278
Fixes https://github.com/llvm/llvm-project/issues/61387

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D146140
2023-03-17 22:29:48 +02:00
..
ackermann.cpp
address_space-dependent.cpp [clang][WebAssembly] Initial support for reference type funcref in clang 2023-03-17 18:31:44 +01:00
address-spaces.cpp
alias-church-numerals.cpp
alias-nested-nontag.cpp
alias-template-nondependent.cpp
alias-template-template-param.cpp
alias-templates.cpp [C++2a] P0634r3: Down with typename! 2022-09-28 09:50:19 -07:00
alignas.cpp
ambiguous-ovl-print.cpp
anonymous-union.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
argument-dependent-lookup.cpp
array-redeclaration.cpp
array-to-pointer-decay.cpp
atomics.cpp Relax assert in ExprConstant to a return None. 2021-10-21 13:09:56 +01:00
attributes.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
canonical-expr-type-0x.cpp
canonical-expr-type.cpp
class-template-ctor-initializer.cpp
class-template-decl.cpp
class-template-id-2.cpp
class-template-id.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
class-template-noexcept.cpp let EST_Uninstantiated in FunctionProtoType::canThrow return 2022-03-16 07:09:42 -07:00
class-template-spec.cpp
concepts-friends.cpp [Concepts] Fix friend-checking to include NTTPs 2022-11-16 07:33:15 -08:00
concepts-GH53354.cpp Fix crash in constraining partial specialization on nested template. 2022-10-20 10:46:18 +02:00
concepts-lambda.cpp GH60642: Fix ICE when checking a lambda defined in a concept definition 2023-02-17 06:09:52 -08:00
concepts-out-of-line-def.cpp [Clang][Sema] Start fixing handling of out-of-line definitions of constrained templates 2023-03-10 09:21:09 +00:00
concepts-PR54629.cpp [Sema] Fix assertion failure when instantiating requires expression 2022-06-23 16:20:30 +02:00
concepts-recovery-expr.cpp Reapply "[Concepts] Recover properly from a RecoveryExpr in a concept" 2022-09-26 08:39:10 -07:00
concepts-recursive-inst.cpp Fix recursive error for constraints depending on itself incorrectly 2023-01-27 11:11:53 -08:00
concepts-using-decl.cpp [clang] Do not hide base member using-decls with different template head. 2022-10-27 11:52:46 +02:00
concepts.cpp [clang] Properly parse variable template requires clause in lambda 2023-03-17 22:29:48 +02:00
constexpr-instantiate.cpp [clang] Prevent folding of non-const compound expr 2022-05-16 07:50:39 +02:00
constraints.cpp [AST] Better recovery on an expression refers to an invalid decl. 2022-09-22 14:23:47 +02:00
constructor-template.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
copy-ctor-assign.cpp
crash-8204126.cpp
crash-10438657.cpp
crash-unparsed-exception.cpp
crash.cpp
ctad.cpp Treat implicit deduction guides as being equivalent to their 2021-05-19 13:31:53 -07:00
current-instantiation.cpp
cxx1z-decomposition.cpp
cxx1z-fold-expressions.cpp Revert two patches to fix GH58452 regression 2023-03-09 09:16:53 -08:00
cxx1z-using-declaration.cpp
cxx2a-constraint-caching.cpp Revert "[clang] Instantiate concepts with sugared template arguments" 2023-01-17 07:29:31 -08:00
cxx2a-constraint-exprs.cpp [AST] Better recovery on an expression refers to an invalid decl. 2022-09-22 14:23:47 +02:00
cxx17-inline-variables.cpp
deduction-crash.cpp [clang] set templates as invalid when any of the parameters are invalid 2021-09-25 04:04:47 +02:00
deduction-guide-partial-ordering.cpp [Clang] constraints partial ordering should work with deduction guide 2022-10-18 17:30:47 -07:00
deduction-guide.cpp [clang][TypePrinter] Teach isSubstitutedDefaultArgument about integral types 2022-12-16 11:38:51 +00:00
deduction.cpp [clang] Changes to produce sugared converted template arguments 2022-10-27 05:50:00 +02:00
default-arguments-ast-print.cpp Print default template argument if manually specified in typedef declaration. 2021-06-29 14:57:26 +00:00
default-arguments-cxx0x.cpp
default-arguments.cpp [clang] Correct handling of lambdas in lambda default arguments in dependent contexts. 2022-10-04 09:04:54 -07:00
default-expr-arguments-2.cpp
default-expr-arguments-3.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
default-expr-arguments.cpp
default-member-init.cpp
defaulted-destructor-in-temporary.cpp [Sema] Mark the referenced destructor during transformation of a CXXBindTemporaryExpr 2022-03-08 01:00:07 -08:00
defaulted.cpp
deferred-concept-inst.cpp Re-apply "Deferred Concept Instantiation Implementation" 2022-09-22 05:53:59 -07:00
delegating-constructors.cpp Add type information to integral template argument if required. 2021-05-12 19:00:08 +00:00
dependent-base-classes.cpp
dependent-base-member-init.cpp
dependent-class-member-operator.cpp
dependent-expr.cpp [Clang][Sema] Prohibit statement expression in the default argument 2022-04-06 09:28:20 +08:00
dependent-names-no-std.cpp
dependent-names.cpp [clang][TypePrinter] Teach isSubstitutedDefaultArgument about integral types 2022-12-16 11:38:51 +00:00
dependent-sized_array.cpp
dependent-template-recover.cpp
dependent-type-identity.cpp
dependent-typos-recovery.cpp
derived.cpp Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
destructor-template.cpp [Concepts] Implement overload resolution for destructors (P0848) 2022-06-19 00:30:37 +03:00
diagnose-enable-if-t.cpp [clang] Enable the special enable_if_t diagnostics for libc++'s __enable_if_t as well. 2021-09-11 13:44:51 -05:00
elaborated-type-specifier.cpp
enum-argument.cpp
enum-bool.cpp
enum-forward.cpp
example-typelist.cpp
exception-spec-crash.cpp
explicit-instantiation.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
explicit-specialization-member.cpp
ext_ms_template_spec.cpp
ext-vector-type.cpp
extension-sfinae.cpp
extern-templates.cpp
fibonacci.cpp
find-unexpanded-packs.cpp An expression should only contain an unexpanded parameter pack if it 2022-03-31 20:02:53 -07:00
friend-template.cpp [clang][SemaTemplate] Fix a stack use after scope 2022-02-17 21:47:50 +01:00
friend.cpp [clang] retain type sugar in auto / template argument deduction 2021-11-15 23:07:45 +01:00
fun-template-def.cpp [Sema] Add test for new errors due to 09f8315bba 2022-01-18 22:18:35 +01:00
function-pointer-qualifier.cpp
function-template-specialization-noreturn.cpp
function-template-specialization.cpp
generic-lambda.cpp [clang] don't instantiate templates with injected arguments 2021-09-29 23:19:13 +02:00
gh57362.cpp [Clang] Fix compat diagnostic to detect a nontype template parameter has a placeholder type using getContainedAutoType() 2022-09-18 11:54:32 -07:00
gh57943.cpp Fix GH57943: Friend constraint checker didn't handle null decls. 2022-09-23 12:21:56 -07:00
implicit-instantiation-1.cpp
inject-templated-friend-post.cpp
inject-templated-friend.cpp
injected-class-name.cpp
instantiate-abbreviated-template.cpp
instantiate-after-fatal-cxx17.cpp
instantiate-anonymous-union.cpp
instantiate-array.cpp
instantiate-attr.cpp [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct is passed to a function 2022-07-13 15:32:29 -04:00
instantiate-c99.cpp
instantiate-call.cpp
instantiate-case.cpp
instantiate-cast.cpp
instantiate-clang.cpp [Sema] Fix ExtVectorElementExpr tree transform for the isArrow case. 2022-10-11 13:29:20 -07:00
instantiate-complete.cpp
instantiate-decl-dtor.cpp
instantiate-decl-init.cpp
instantiate-declref-ice.cpp
instantiate-declref.cpp
instantiate-deeply.cpp
instantiate-default-assignment-operator.cpp
instantiate-dependent-nested-name.cpp
instantiate-elab-type-specifier.cpp
instantiate-enum-2.cpp
instantiate-enum.cpp
instantiate-exception-spec-cxx11.cpp
instantiate-exception-spec.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
instantiate-expanded-type-constraint.cpp
instantiate-explicitly-after-fatal.cpp
instantiate-expr-1.cpp Stop wrapping GCCAsmStmts inside StmtExprs to destruct temporaries 2022-06-17 17:28:00 -07:00
instantiate-expr-2.cpp
instantiate-expr-3.cpp
instantiate-expr-4.cpp
instantiate-expr-5.cpp
instantiate-expr-6.cpp
instantiate-expr-basic.cpp
instantiate-field.cpp
instantiate-friend-class.cpp
instantiate-friend-function.cpp
instantiate-function-1.cpp
instantiate-function-1.mm
instantiate-function-2.cpp
instantiate-function-params.cpp
instantiate-incomplete-typo-suggested-error-limit.cpp
instantiate-init.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
instantiate-invalid.cpp
instantiate-local-class.cpp [clang] Correct handling of lambdas in lambda default arguments in dependent contexts. 2022-10-04 09:04:54 -07:00
instantiate-member-class.cpp
instantiate-member-expr.cpp
instantiate-member-initializers.cpp
instantiate-member-pointers.cpp
instantiate-member-specialization.cpp
instantiate-member-template.cpp
instantiate-method.cpp
instantiate-non-dependent-types.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
instantiate-non-type-template-parameter.cpp
instantiate-objc-1.mm
instantiate-overload-candidates.cpp
instantiate-overloaded-arrow.cpp
instantiate-partial-spec.cpp
instantiate-requires-clause.cpp Re-apply "Deferred Concept Instantiation Implementation" 2022-09-22 05:53:59 -07:00
instantiate-requires-expr.cpp Revert "[clang] Instantiate concepts with sugared template arguments" 2023-01-17 07:29:31 -08:00
instantiate-scope.cpp
instantiate-self.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
instantiate-sizeof.cpp
instantiate-static-local.cpp
instantiate-static-var.cpp Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
instantiate-subscript.cpp [C++2b] Implement multidimentional subscript operator 2022-02-08 12:10:47 -05:00
instantiate-template-argument.cpp
instantiate-template-template-parm.cpp Revert "[clang] deprecate frelaxed-template-template-args, make it on by default" 2021-11-02 17:02:19 -04:00
instantiate-try-catch.cpp
instantiate-type.cpp
instantiate-typedef.cpp
instantiate-typeof.cpp
instantiate-using-decl.cpp
instantiate-var-template.cpp [Clang] Implement CWG2518 - static_assert(false) 2023-02-28 17:21:40 +01:00
instantiation-backtrace.cpp
instantiation-default-1.cpp [clang] Instantiate NTTPs and template default arguments with sugar 2022-10-31 17:57:18 +01:00
instantiation-default-2.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
instantiation-default-3.cpp
instantiation-dependence.cpp [Clang] Implement CWG2518 - static_assert(false) 2023-02-28 17:21:40 +01:00
instantiation-depth-defarg.cpp
instantiation-depth-default.cpp [Windows] Convert clang/test/Modules tests to check 'target=<triple>' 2022-11-29 12:17:36 -08:00
instantiation-depth-exception-spec.cpp
instantiation-depth-subst-2.cpp
instantiation-depth-subst.cpp
instantiation-depth.cpp
instantiation-order.cpp
issue150.cpp
lambda-capture-pack.cpp Diagnose -Wunused-value based on CFG reachability 2021-09-28 10:00:15 -07:00
late-parsing-eager-instantiation.cpp
lookup-dependent-bases.cpp
make_integer_seq.cpp Revert "[clang] Instantiate alias templates with sugar" 2022-11-08 17:19:54 +01:00
matrix-type.cpp Add type information to integral template argument if required. 2021-05-12 19:00:08 +00:00
member-access-ambig.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
member-access-expr.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
member-function-template.cpp
member-inclass-init-value-dependent.cpp
member-initializers.cpp
member-specialization.cpp
member-template-access-expr.cpp
metafun-apply.cpp
missing-class-keyword-crash.cpp
missing-typename.cpp
ms-class-specialization-class-scope.cpp
ms-class-specialization-duplicate.cpp
ms-delayed-default-template-args.cpp
ms-function-specialization-class-scope.cpp
ms-if-exists.cpp
ms-lookup-template-base-classes.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
ms-sizeof-missing-typename.cpp
ms-unqualified-base-class.cpp MSVC compatibility mode: fix error on unqualified templated base class initialization in case of partial specialization 2022-08-16 17:09:55 +02:00
nested-deduction-guides.cpp
nested-incomplete-class.cpp
nested-linkage.cpp
nested-name-spec-template.cpp [clang] Implement sugared substitution changes to infrastructure 2022-10-27 06:18:07 +02:00
nested-template.cpp Revert "[clang] deprecate frelaxed-template-template-args, make it on by default" 2021-11-02 17:02:19 -04:00
non-integral-switch-cond.cpp
nss-recovery.cpp
operator-function-id-template.cpp
operator-template.cpp [clang] retain type sugar in auto / template argument deduction 2021-11-15 23:07:45 +01:00
overload-candidates.cpp
overload-uneval.cpp
overloaded-functions.cpp
pack-deduction.cpp Revert two patches to fix GH58452 regression 2023-03-09 09:16:53 -08:00
partial-order.cpp
partial-spec-instantiate.cpp When performing template argument deduction to select a partial 2021-05-05 14:47:18 -07:00
pr47676.cpp [test][Sema] Ignore stderr in test 2022-08-17 23:50:35 -07:00
pr52909.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
pr52970.cpp Revert "[clang] Instantiate concepts with sugared template arguments" 2023-01-17 07:29:31 -08:00
pragma-ms_struct.cpp
qualified-id.cpp
qualified-names-diag.cpp
rdar9173693.cpp
recovery-crash.cpp
recovery-tree-transform-crash.cpp
recovery-tree-transform.cpp
recursive-template-instantiation.cpp
resolve-single-template-id.cpp [clang] Stop providing builtin overload candidate for relational function pointer comparisons 2021-06-26 00:08:02 +02:00
self-comparison.cpp
sizeof-pack.cpp
stack-exhaustion.cpp
stmt-expr.cpp
subst-into-subst.cpp
sugar-crashes.cpp Fix one of the regressions found in revert of concept sugaring 2023-01-25 06:01:44 -08:00
temp_arg_enum_printing_more.cpp
temp_arg_enum_printing.cpp [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values 2022-07-28 15:27:50 -07:00
temp_arg_nontype_cxx1z.cpp [clang] Changes to produce sugared converted template arguments 2022-10-27 05:50:00 +02:00
temp_arg_nontype_cxx11.cpp Fix type printing of array template args 2021-05-01 18:50:09 +00:00
temp_arg_nontype_cxx20.cpp Disambiguate type names when printing NTTP types 2022-10-28 08:18:38 -04:00
temp_arg_nontype_diagnostic_cxx17.cpp [Clang] Fix compat diagnostic to detect a nontype template parameter has a placeholder type using getContainedAutoType() 2022-09-18 11:54:32 -07:00
temp_arg_nontype.cpp Revert "[clang] Instantiate alias templates with sugar" 2022-11-08 17:19:54 +01:00
temp_arg_pack.cpp
temp_arg_string_printing.cpp Disambiguate type names when printing NTTP types 2022-10-28 08:18:38 -04:00
temp_arg_template_cxx1z.cpp Revert "[clang] deprecate frelaxed-template-template-args, make it on by default" 2021-11-02 17:02:19 -04:00
temp_arg_template.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
temp_arg_type.cpp
temp_arg.cpp [test] Make tests pass regardless of gnu++14/gnu++17 default 2022-09-04 05:29:32 +00:00
temp_class_order.cpp
temp_class_spec_blocks.cpp
temp_class_spec_neg.cpp
temp_class_spec.cpp [clang] Invalidate a non-dependent-type RecordDecl when it has any dependent-type base class specifier. 2021-05-20 15:33:05 +02:00
temp_explicit_cxx0x.cpp
temp_explicit.cpp
temp_func_order.cpp
temp-param-subst-linear.cpp
temp.cpp
template-class-traits.cpp
template-decl-fail.cpp
template-id-expr.cpp
template-id-printing.cpp
trailing-return-short-circuit.cpp Re-apply "Deferred Concept Instantiation Implementation" 2022-09-22 05:53:59 -07:00
type_pack_element.cpp [clang] Perform sugared substitution of builtin templates 2022-10-27 06:01:12 +02:00
typename-specifier-2.cpp
typename-specifier-3.cpp [C++2a] P0634r3: Down with typename! 2022-09-28 09:50:19 -07:00
typename-specifier-4.cpp
typename-specifier.cpp
typo-dependent-name.cpp
typo-template-name.cpp
typo-variadic.cpp
undeclared-template.cpp
undefined-template.cpp
unresolved-construct.cpp
unused-variables.cpp
using-decl.cpp
value-dependent-bitfield-cond.cpp
value-dependent-null-pointer-constant.cpp
virtual-member-functions.cpp [clang] Implement ElaboratedType sugaring for types written bare 2022-07-27 11:10:54 +02:00
warn-thread-safety-analysis.cpp