[PATCH] D89286: [DebugInfo] Check for templated static data member when adding constant to record static fields

Sylvain Audi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 09:09:58 PDT 2020


saudi added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1420
+  if (Var->getInit())
+    Value = Var->evaluateValue();
+  else if (auto *TemplateDecl = Var->getInstantiatedFromStaticDataMember()) {
----------------
saudi wrote:
> I encountered an assert inside `evaluateValue()` call :
> `assert(!Init->isValueDependent());`
> 
> repro code:
> ```
> template <int VAL> class A {
>  static constexpr int dep = VAL;
> };
> A<10> a;
> ```
> Note that it crashed with `static constexp` member but not with `static const`.
> 
Sorry, I got the wrong line for this comment.
This was actually the case 1. from @dblaikie 's comment for the `TemplateDecl` evaluation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89286/new/

https://reviews.llvm.org/D89286



More information about the cfe-commits mailing list