[llvm-bugs] [Bug 49238] New: reference to local binding fails in enclosing function

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 17 18:24:56 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49238

            Bug ID: 49238
           Summary: reference to local binding fails in enclosing function
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 24549
  --> https://bugs.llvm.org/attachment.cgi?id=24549&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210218/cdee0fdd/attachment.html>


More information about the llvm-bugs mailing list