[LLVMbugs] [Bug 14804] New: Spurious unused expression warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 4 13:03:25 PST 2013


             Bug #: 14804
           Summary: Spurious unused expression warning
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvm.org at halfy.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9807
  --> http://llvm.org/bugs/attachment.cgi?id=9807
Test to reproduce a spurious unused expression warning on templated classes.

Similar to bug 8806, but I think this one is valid.

I have a templated code that is giving me an "expression result unused"
warning, thinking that an argument list is a comma expression.

Attached is the code, which is highly stripped down from a widely-used
production code (http://www.openvdb.org/). 

Compile as: 

> clang++ -c bogus_unused_expr_warn.cc

If I do either of the things below, the warning goes away, leading me to think
that there's an error in the unused result detection heuristic:
a) Remove the "bool Root=false" from the Item class's template parameter list.
b) Change the Item::probe function to a non-templated function.

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