http://llvm.org/bugs/show_bug.cgi?id=9382
Summary: Incorrect "'noreturn' should not return" when there's
code after a nested call to a noreturn member function
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
$ cat test.cc
struct Errors {
void fatal() __attribute__((noreturn));
};
void gold_fatal(const char* format) __attribute__((noreturn));
void gold_fatal(const char* format) {
Errors().fatal();
(void)3;
}
$ clang++ -Wall -Werror -c test.cc
test.cc:14:1: error: function declared 'noreturn' should not return
[-Werror,-Winvalid-noreturn]
}
^
1 error generated.
--------------
Removing the (void)3; or taking 'fatal' out of Errors causes the warning to go
away.
Arguably, clang should generate an "unreachable code" warning instead, but the
original code after the noreturn call was a va_end() call, which seems nice to
keep symmetric.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs