cor3ntin wrote:

@AaronBallman @efriedma-quic can you expand on the set of breakages you expect?

> I'm not sure this PR would actually break any compilations which work today, 
> since currently we fail to build anything which would require instantiation 
> during constant evaluation. With this PR, we will accept some such code that 
> would've previously failed, but continue to reject (or potentially crash the 
> compiler) on other such code. 

Yes, that's the intent

> If you write something like the following:
> int x = f();
> This triggers constant evaluation of f(), 

This is not a constant context - and also we do not want that behavior in 
constant initialization, so in that case we should *not* instantiate `f` . The 
only case where we want to go through with instantiation is when we always 
**need**  `f`.

consider for example https://compiler-explorer.com/z/sdv153zx8 - that's not 
something we want to break - even though the standard is not clear on that 
point.

(similarly, this PR does not instantiate on constant folding or any context 
where the standard does not require f() to have been instantiated)

https://github.com/llvm/llvm-project/pull/205557
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to