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

            Bug ID: 40598
           Summary: diagnostics: "no return statement in constexpr
                    function" when return exists but has bad type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Given

constexpr int foo() {
    return "asdf";
}

Clang produces:

<source>:2:12: error: cannot initialize return object of type 'int' with an
lvalue of type 'const char [5]'
    return "asdf";
           ^~~~~~
<source>:1:15: error: no return statement in constexpr function
constexpr int foo() {


The second error is clearly unhelpful in this case.

-- 
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