[llvm-bugs] [Bug 27148] New: Clang incorrectly treat capture-by-reference variable in lambda as constexpr

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 30 16:54:48 PDT 2016


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

            Bug ID: 27148
           Summary: Clang incorrectly treat capture-by-reference variable
                    in lambda as constexpr
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ytj000 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code shows clang has inconsistent behavior.

struct A {
    constexpr operator int() const { return 0; }
};

int main() {
    A a;
    [&a]() { constexpr int b = a; };  // clang incorrectly accepted

    A &ra = a;
    constexpr int b = ra; // clang rejected
}

-- 
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/20160330/1dac379a/attachment.html>


More information about the llvm-bugs mailing list