[llvm-bugs] [Bug 40598] New: diagnostics: "no return statement in constexpr function" when return exists but has bad type
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 4 21:31:15 PST 2019
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: unassignedclangbugs at nondot.org
Reporter: comexk at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190205/9f6b8fc7/attachment-0001.html>
More information about the llvm-bugs
mailing list