Bug 101911 - Type cannot be defined inside of the lambda in unevaluated context
Summary: Type cannot be defined inside of the lambda in unevaluated context
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: c++-lambda, rejects-valid
: 102367 119072 122688 (view as bug list)
Depends on: 103901
Blocks: c++-lambda-decltype lambdas
  Show dependency treegraph
 
Reported: 2021-08-14 17:33 UTC by Eligor Kadaf
Modified: 2026-01-12 18:18 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 11.2.0
Last reconfirmed: 2024-04-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eligor Kadaf 2021-08-14 17:33:47 UTC
The following code is rejected by gcc:

#include <vector>

int main() {
   std::vector<decltype([] { 
  struct { int x; } x;
  return x; }()) > vec;
}
gcc claims that types cannot be defined inside of decltype. Hovewer, I did not find anything in standard to confirm such a message in this context. So if you need any proof, proof me please that there is a reason for gcc to claim that first.

https://godbolt.org/z/8n6djencY
Comment 1 Drea Pinski 2021-08-14 20:17:08 UTC
Confirmed.
Comment 2 Drea Pinski 2021-10-12 23:40:53 UTC
*** Bug 102367 has been marked as a duplicate of this bug. ***
Comment 3 Drea Pinski 2025-03-01 05:40:28 UTC
*** Bug 119072 has been marked as a duplicate of this bug. ***
Comment 4 Drea Pinski 2025-11-14 16:58:10 UTC
*** Bug 122688 has been marked as a duplicate of this bug. ***