[LLVMbugs] [Bug 17897] New: clang says a used variable is unused

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 12 09:30:34 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17897

            Bug ID: 17897
           Summary: clang says a used variable is unused
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang says flow is not used, but commenting it changes the value of foobarzed.

namespace {
struct foo {};
}
template <typename T, T> struct SameType;
template <class T> struct has_FlowTraits2 {
  struct Fallback {
    bool flow;
  };
  struct Derived : T, Fallback {};
  template <typename C>
  static char (&f(SameType<bool Fallback::*, &C::flow> *))[1];
  template <typename C> static char (&f(...))[2];
  static bool const value = sizeof(f<Derived>(0)) == 2;
};
template <typename T> struct SequenceTraits2 {};
template <> struct SequenceTraits2<foo> {
  static const bool flow = true; // HERE
};
bool foobarzed = has_FlowTraits2<SequenceTraits2<foo> >::value;

-- 
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/20131112/14f9ff30/attachment.html>


More information about the llvm-bugs mailing list