[LLVMbugs] [Bug 9382] New: Incorrect "'noreturn' should not return" when there's code after a nested call to a noreturn member function
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Wed Mar  2 15:31:22 PST 2011
    
    
  
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: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
$ 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.
    
    
More information about the llvm-bugs
mailing list