[llvm-bugs] [Bug 31046] New: NSDMI seems to disable unused variable warning

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 17 14:56:10 PST 2016


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

            Bug ID: 31046
           Summary: NSDMI seems to disable unused variable warning
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yaghmour.shafik at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Given the following code:

struct A1 {
  double x = 1; // NSDMI seems to disable the unused variable warning
};

struct A2 {
  double x ;  
};

void f() {
    A1 a1 ; // No unused variable warning
    A2 a2 ; // OK unused variable warning

}

int main(){}

and compiling using:

clang++ -std=c++11 -Wall 

I receive a warning for a2 being unused but not for a1:

warning: unused variable 'a2' [-Wunused-variable]
    A2 a2 ; // OK unused variable warning
       ^

It looks like the use of NSDMI disables this warning. Is this intended
behavior? It seems unexpected that simply using NSDMI would disable this
warning for a class.

-- 
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/20161117/b4cf8527/attachment-0001.html>


More information about the llvm-bugs mailing list