[llvm-bugs] [Bug 48741] New: Using constexpr variable in pragma fails with "reference to local variable" when using auto lambda

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 13 09:45:48 PST 2021


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

            Bug ID: 48741
           Summary: Using constexpr variable in pragma fails with
                    "reference to local variable" when using auto lambda
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryan_greenblatt at brown.edu
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Here is a pretty minimal reproduction:
```
template <typename F> void caller(const F &f) { f(0); }

template <typename T> void f() {
  constexpr unsigned v = 8;
  caller([=](auto) {
#pragma unroll v
    for (;;) {
    }
  });
}

int main() { f<int>(); }
```

https://godbolt.org/z/9o3chf

The issue occurs with -std=c++14 on all version of clang after 4.

-- 
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/20210113/f0a955c3/attachment.html>


More information about the llvm-bugs mailing list