[llvm-bugs] [Bug 31638] New: diagnose_if generates duplicate diagnostics

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 13 15:59:08 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31638

            Bug ID: 31638
           Summary: diagnose_if generates duplicate diagnostics
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

In the example below 3 diagnostics are generated for each `diagnose_if` failure
when only one diagnostic should be:

Example:

// clang++ -std=c++11 test.cpp
struct String {
  String(char const* __s)
    __attribute__((diagnose_if(__s == nullptr, "oh no", "warning")));
   // expected-warning at -1 3 {{oh no}}

  String(int __s)
      __attribute__((diagnose_if(__s != 0, "oh no", "warning")))
  // expected-warning at -1 3 {{oh no}}
  {
  }
};

String::String(char const* __s) {}

int main() {
  String s(nullptr);
  String ss(42);
}

-- 
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/20170113/8012a1b2/attachment.html>


More information about the llvm-bugs mailing list