Fixing warning C4189 in SemaTemplateDeduction.cpp

Yaron Keren yaron.keren at gmail.com
Wed May 13 09:42:47 PDT 2015


Hi Aaron,

What do you think about fixing:

tools\clang\lib\Sema\SemaTemplateDeduction.cpp(3660): warning C4189:
'Result' : local variable is initialize d but not referenced

with

Index: tools/clang/lib/Sema/SemaTemplateDeduction.cpp
===================================================================
--- tools/clang/lib/Sema/SemaTemplateDeduction.cpp      (revision 237261)
+++ tools/clang/lib/Sema/SemaTemplateDeduction.cpp      (working copy)
@@ -3656,8 +3656,10 @@
   FunctionTemplateDecl *InvokerTemplate = LambdaClass->
                   getLambdaStaticInvoker()->getDescribedFunctionTemplate();

-  Sema::TemplateDeductionResult LLVM_ATTRIBUTE_UNUSED Result
-    = S.FinishTemplateArgumentDeduction(InvokerTemplate, DeducedArguments,
0,
+#ifndef NDEBUG
+  Sema::TemplateDeductionResult LLVM_ATTRIBUTE_UNUSED Result =
+#endif
+    S.FinishTemplateArgumentDeduction(InvokerTemplate, DeducedArguments, 0,
           InvokerSpecialized, TDInfo);
   assert(Result == Sema::TDK_Success &&
     "If the call operator succeeded so should the invoker!");


The problem is LLVM_ATTRIBUTE_UNUSED does not work with Visual C++.

Yaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150513/79971ecb/attachment.html>


More information about the cfe-commits mailing list