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: unassignedclangb...@nondot.org
          Reporter: com...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to