https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96184

Christoph <foss at grueninger dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |foss at grueninger dot de

--- Comment #10 from Christoph <foss at grueninger dot de> ---
I think in GCC 16 the old behavior returned.

Using the example code with g++-16 (SUSE Linux) 16.0.1 20260321 (experimental):

gruenich@piaf:~> g++-16 test.cc
test.cc: In function ‘int main()’:
test.cc:4:40: error: use of local variable with automatic storage from
containing function
    4 |     auto p = [ ] () noexcept ( b ? 0 : a = b) { return 0;};
      |                                        ^
test.cc:2:9: note: ‘int a’ declared here
    2 |     int a  = 10;
      |         ^

This is unfortunate, as we use the code and is was working for years with GCC
and Clang. If this change (back) is intended, this should be mentioned in the
porting to documentation.

Reply via email to