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

            Bug ID: 47926
           Summary: Variable of dependent non-literal type in constexpr
                    not correctly diagnosed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

This TU:

    template <class T>
    constexpr bool f() {
        if (!__builtin_is_constant_evaluated()) {
            [[maybe_unused]] T t;
        }

        return true;
    }

    struct nonliteral {
        ~nonliteral() {}
    };

    static_assert(f<nonliteral>(), "should fail");

is ill-formed per N4868 [dcl.constexpr]/3.5.3 "The definition of a constexpr
function shall satisfy the following requirements:... its function-body shall
not enclose... a definition of a variable of non-literal type ...". Clang fails
to diagnose this TU (https://godbolt.org/z/xoMGxs).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to