[PATCH] D18425: [Sema] Make enable_if act correctly with value dependent conditions/arguments

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 17:10:46 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Sema/SemaExpr.cpp:5218-5221
@@ -5209,1 +5217,6 @@
+      Fn, NDecl, LParenLoc, ArgExprs, RParenLoc, ExecConfig, IsExecConfig);
+
+  if (MakeCallInstantiationDependent)
+    BuiltCall.get()->setInstantiationDependent(true);
+  return BuiltCall;
 }
----------------
Hmm, good point, you might see a change in a contrived case like this:

  constexpr bool g() __attribute__((enable_if(true, ""))) { return false; }
  template<bool B> void f() {
    constexpr bool g() __attribute__((enable_if(B, "")));
    static_assert(g());
  }

... where we can diagnose the `static_assert` failure at template definition time if the call is not value-dependent.


http://reviews.llvm.org/D18425





More information about the cfe-commits mailing list