ilya-biryukov wrote:

Here's a small repro:
```cpp
export module Foo;

export template <class Float>
struct Wrapper {
  double value;
};

export constexpr Wrapper<double> Compute() {
  return Wrapper<double>{1.0};
}

export template <typename Float>
Wrapper<Float> ComputeInFloat() {
  const Wrapper<Float> a = Compute();
  return a;
}
```

it fails when assertions are on: https://gcc.godbolt.org/z/vsW69z9Pd

The problem is that type of the `VarDecl` itself is dependent (the dependent 
`TemplateSpecializationType`) and so `castAs` fails.

My gut feeling is that the right fix would be to avoid running 
`CheckEvaluationResult` if `VarDecl` has a dependent type altogether and leave 
this diagnostic to template instantiations.

https://github.com/llvm/llvm-project/pull/145447
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to