[LLVMbugs] [Bug 7047] New: Nuisance "self-comparison" Warning from Template code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 4 15:19:59 PDT 2010


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

           Summary: Nuisance "self-comparison" Warning from Template code
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: me22.ca at gmail.com
                CC: llvmbugs at cs.uiuc.edu


With this code

    template <int A, int B,
              bool Q = (A<B), bool W = (A>B)>
    struct base {};

    template <int A, int B>
    struct other : base<A, B> {};

    template <int C>
    struct other<C,C> : base<C,C> {};

I get the following warnings

    $ clang++ clang.cc -Wall -Wextra -fsyntax-only
    clang.cc:2:36: warning: self-comparison always results in a constant value
    template <int A, int B, bool q = (A<B), bool w = (A>B)>
                                       ^
    clang.cc:9:21: note: in instantiation of default argument for 'base<C, C>'
          required here
    struct other<C,C> : base<C,C> {};
                        ^~~~~~~~~
    clang.cc:2:52: warning: self-comparison always results in a constant value
    template <int A, int B, bool q = (A<B), bool w = (A>B)>
                                                       ^
    3 diagnostics generated.

which are just a nuisance in this case.  g++ does not give a warning for this
code.

-- 
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