https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104304
Bug ID: 104304 Summary: Compiler allows using a lambda with a capture as non-type template parameter (C++20) Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dk949.david at gmail dot com Target Milestone: --- Created attachment 52316 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52316&action=edit Small test case (preprocessed .ii). GCC version: 11.1.0 System type: linux x86_64 Flags used to compile the test case: '-Wpedantic' '-Wall' '-Wextra' '-std=c++20' Compiler output: No output Expected behavior: Compilation error, or a warning. Observed behavior: Sample compiles with no warnings or errors. Details: It should not be possible (if I understand the standard correctly) to pass a lambda which captures something as a non-type template parameter, as it is not a structured* type (because it has private non-static** members). * C++ ISO standard 13.2 (6) ** C++ ISO standard 7.5.5.3 (10.2)