[LLVMbugs] [Bug 6884] New: Clang fails to account for no-return destructors in warnings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 20 19:05:55 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6884

           Summary: Clang fails to account for no-return destructors in
                    warnings
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Below, the noretutrn 'abort' function correctly prevents any warnings about
returning from a non-void function, but a noreturn destructor on a temporary
object fails to do this. These structures can be used to stream out a fatal
message prior to calling abort, among other cases.

% cat t.cc
void abort() __attribute__((noreturn));

struct abort_struct {
  abort_struct() {}
  ~abort_struct() __attribute__((noreturn)) { abort(); }
};

int f(int x) {
  switch (x) { default: abort(); }
}

int g(int x) {
  switch (x) { default: abort_struct(); }
}

% ./bin/clang -fsyntax-only -Wall t.cc
t.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

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