Issue 100897
Summary Templated lambda invoked in compile time doesn't instantiates if declared inside templated function
Labels new issue
Assignees
Reporter GuzevArtem
    ```
template<typename>
[[nodiscard]]
constexpr auto foo() noexcept
{
    constexpr auto extract_size = []<typename argument_t>() constexpr -> int
    {
        return 1;
    };
 //return extract_size.template operator()<int>(); // works
    constexpr int result = extract_size.template operator()<int>(); // undefined function 'operator()<int>'
    return result;
}

int main() {
 return foo<void>();
}
```

https://godbolt.org/z/6bj4d6zef

<source>:10:19: error: constexpr variable 'result' must be initialized by a constant _expression_
<source>:10:50: note: undefined function 'operator()<int>' cannot be used in a constant _expression_

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to