[cfe-commits] [Patch] When inside template instantiations, prevent warnings on constant operands of logical operators.

Richard Trieu rtrieu at google.com
Thu Jul 14 16:36:22 PDT 2011


Remove warnings of constant operands of logical operators from template
instantiations.  Upon instantiation of template, value-dependent parameters
are replaced by equivalent literals, so code like:

template<unsigned int A, unsigned int B> struct S {
  int foo() {
    int x = A && B;
  }
}

will not warn on A && B on every instantiation.  This will still warn on
other cases inside templates, which will be caught on checking the template
definition.

Patch attached and available at http://codereview.appspot.com/4650076/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110714/f80c400f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logical-operands-in-templates.patch
Type: text/x-patch
Size: 1764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110714/f80c400f/attachment.bin>


More information about the cfe-commits mailing list