yronglin wrote:

> > > IMO this is incorrect. https://eel.is/c++draft/type.traits clearly states 
> > > that both types have to be complete.
> > 
> > 
> > > T is a reference type, and the initialization T t(VAL); is well-formed
> > 
> > 
> > If the precondition `T is a reference type` is not satisfied, I think the 
> > compiler should not try to instantiation `T t(VAL<U>);`. This is what the 
> > PR want to fix.
> 
> The precondition is "T and U shall be complete types, cv void, or arrays of 
> unknown 
> bound[.](https://eel.is/c++draft/type.traits#tab:meta.unary.prop-row-48-column-3-sentence-1)".
> 
> The check for which this patch disables if the first argument isn't a 
> reference type.

Good catch! I understood.

```cpp
struct NoConv;
struct Bad;

template <class T, class U>
constexpr bool fff() {
  return __reference_constructs_from_temporary(T, U);
}
constexpr bool a = fff<Bad, NoConv&&>();

```

The above code should be rejected. 

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

Reply via email to