[llvm-bugs] [Bug 31637] New: diagnose_if attribute cannot be used on constructors

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


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

            Bug ID: 31637
           Summary: diagnose_if attribute cannot be used on constructors
           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

When placed at the end of a constructor declaration the diagnose_if attribute
doesn't correctly parse the arguments. Additionally if an initializer list is
present the diagnose_if attribute will cause Clang to segfault.

Example:

// clang++ -std=c++1z test.cpp
struct Foo {
  int II = 42;
  Foo(int I) __attribute__((diagnose_if(I, "oh no", "error")))
  // expected-error at -1 {{use of undeclared identifier 'I'}}
  {}

  Foo(int I, int J) __attribute__((diagnose_if(I, "oh no", "error")))
    : II(I) {} // ICE's clang
};

int main() {
  Foo f(1);
  Foo ff(1, 1);
}

-- 
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/8fce23be/attachment.html>


More information about the llvm-bugs mailing list