Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

reference to local binding fails in enclosing function #48207

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR49238
Status NEW
Importance P enhancement
Reported by Yuri (yuri@tsoft.com)
Reported on 2021-02-17 18:24:56 -0800
Last modified on 2021-11-12 05:43:51 -0800
Version 12.0
Hardware PC FreeBSD
CC blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, maic23@live.de, richard-llvm@metafoo.co.uk, samestimable2016@gmail.com, saurik@saurik.com
Fixed by commit(s)
Attachments testcase-clang.cpp (166 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 24549
testcase-clang.cpp

The attached testcase fails in clang++{9,10,11}:

> testcase-clang.cpp:11:16: error: reference to local binding 'a' declared in
enclosing function 'f'
>         return a+b;
>                ^
> testcase-clang.cpp:9:11: note: 'a' declared here
>     auto [a, b] = newTuple();
>           ^
> testcase-clang.cpp:11:18: error: reference to local binding 'b' declared in
enclosing function 'f'
>         return a+b;
>                  ^
> testcase-clang.cpp:9:14: note: 'b' declared here
>     auto [a, b] = newTuple();
>              ^
> 2 errors generated.

It succeeds in gcc-10.
Quuxplusone commented 3 years ago

Attached testcase-clang.cpp (166 bytes, text/x-c++src): testcase-clang.cpp

Quuxplusone commented 3 years ago

(For reference, if I understand correctly, this should be allowed by P1091R3 and/or P1381R1; I have also tested this against clang 12.0.5.)

Quuxplusone commented 3 years ago

Yes C++20 does fix this but Clang still complains about it.

Quuxplusone commented 2 years ago

I just checked clang-14 - it is still affected.

Is there an estimate when this will be fixed?