[LLVMbugs] [Bug 19558] New: Partial specialization of variable template causes 'unused variable' warning illegally.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 25 08:05:08 PDT 2014


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

            Bug ID: 19558
           Summary: Partial specialization of variable template causes
                    'unused variable' warning illegally.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lin90162 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I've found partial specialization of variable template causes 'unused variable'
warning illegally.  This issue does not occur when non-partial specialization.

// Test code
template<class T>
constexpr bool is_pointer = false;

template<class T>
constexpr bool is_pointer<T *> = true;

int main()
{
    (void) is_pointer<int *>;
    return 0;
}
// End of test code


Output:

prog.cc:5:16: warning: unused variable 'is_pointer' [-Wunused-const-variable]
constexpr bool is_pointer<T *> = true;
               ^
1 warning generated.



I expected no output.
I tested above code with clang 3.5 HEAD (trunk 206991).

-- 
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/20140425/2a35a5db/attachment.html>


More information about the llvm-bugs mailing list