yuxuanchen1997 wrote:

A noob question but I wanted to make sure that this patch actually intended to 
reject program like this one?
```
#include <type_traits>
#include <vector>

class K {
 public:
  template <class T>
  K(const std::vector<T>& v) {
    static_assert(!std::is_same<T, K>::value, "Error!");
  }
};

void foo(std::vector<K>& inputs) {
  auto v{inputs};
}
```
Compiler Explorer: https://godbolt.org/z/659Pao8j9
GCC has always rejected this program but MSVC and EDG both accepted. After this 
patch, clang also rejects. This is a little unintuitive and I don't know how 
the intention of [CWG2137](https://cplusplus.github.io/CWG/issues/2137.html) 
covered this. 

Just need confirmation that this is intended. 

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

Reply via email to