yaxunl added a comment.
ping
I will provide a detailed description of the issue:
What happen are:
First, fun1 is instantiated as `fun1<0,1>`, which calls lambda function `f(f,
Number<1>)`.
This causes lambda function `f` instantiated as `f(f, Number<1>)`. clang uses
LocalInstantiationScope t
tra added a comment.
Godbolt appears to be OK with the code for both gcc and clang:
https://godbolt.org/z/enec44
Debug build does assert here:
clang++: /work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiate.cpp:3630:
void clang::LocalInstantiationScope::InstantiatedLocal(const clang::Decl *,
yaxunl created this revision.
yaxunl added reviewers: rsmith, rjmccall, tra.
yaxunl requested review of this revision.
A lambda in a function template may be recursively instantiated as the
following example:
template
struct Number
{
static constexpr unsigned value = v;
};
tem