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

            Bug ID: 38962
           Summary: Clang doesn't allow constexpr values of user-defined
                    literal types to be used in lambdas without being
                    captured
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: heavenandhell...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Tests taken from: https://github.com/SephDB/constexpr-format#compiler-support

void testNativeLiteralType() {
    //Compiles fine
    constexpr int n = 0;
    auto D = []{return n;};
    constexpr auto x = D();
}

//Obviously literal type
struct A {
    int a = 0;
};

void testNonNativeLiteralType() {
    //Doesn't compile on clang
    constexpr auto n = A{};
    auto D = []{return n;};
    constexpr auto x = D();
}

Clang: https://godbolt.org/z/ECxj4p
GCC: https://godbolt.org/z/aTiqrx

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to