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: unassignedclangb...@nondot.org
          Reporter: y...@tsoft.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to