-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Lambda expressions at global scope generate unintelligible output. C++ Insights is supposed to replace them with equivalent, explicit class definitions, but this only seems to work properly for lambda expressions defined inside a function.
The following table illustrates the output for a locally defined lambda (fine) vs. two instances of global lambdas (broken).
| Input | C++ Insights |
|---|---|
int main() {
auto x = [a=5](int b) {
return b*a;
};
} |
int main() {
class __lambda_10_14 {
public: inline /*constexpr */ int operator()(int b) const {
return b * a;
}
private:
int a;
public:
__lambda_10_14(int _a)
: a{_a}
{}
};
__lambda_10_14 x = __lambda_10_14{5};
} |
auto x = []() {
return 5;
}; |
__lambda_1_10 x = /* public: inline ~() noexcept; */
static inline int __invoke();
; |
auto x2 = [a=5](int b) {
return b*a;
}; |
__lambda_5_11 x2 = /* public: inline ~() noexcept; */
[inta=5](int binline constexpr int operator()(int b) const
{
return b * a;
}
; |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working