[LLVMbugs] [Bug 9599] New: Conditional expression + noreturn destructor confuses -Wreturn-type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 31 15:34:06 PDT 2011


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

           Summary: Conditional expression + noreturn destructor confuses
                    -Wreturn-type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


void my_abort() __attribute__((noreturn));

struct my_abort_struct {
  my_abort_struct() {}
  ~my_abort_struct() __attribute__((noreturn)) { my_abort(); }
};

int f() {
  false ? (void)0 : (void)my_abort_struct();
}

$ clang -fsyntax-only -Wreturn-type noreturn_conditional.cc
noreturn_conditional.cc:10:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^

Just calling my_abort() in the conditional expression doesn't trigger the
warning.

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