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

            Bug ID: 24630
           Summary: -Wnonnull should not warn when in an unevaluated
                    context.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: e...@efcs.ca
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Currently when a function annotated with __attribute__((nonnull)) is called in
an unevaluated context with a null pointer a -Wnonnull warning is emitted. 
However it is useful to be able to pass null pointers to non-null parameters
within meta-programming. For this reason I don't think the following code
should produce a warning with -Wnonnull.

// clang++ -c -fsyntax-only  -Wnonnull  test.cpp 
int foo(int* __attribute__((nonnull))) { return 42; }
int x = sizeof(foo(0));

Note: g++ does not emit a warning on this code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to