================
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+
+template <bool B>
+struct EnableIf {};
+
+template <>
+struct EnableIf<true> {
+  using type = int;
+};
+
+template <class T, T V>
+struct IntegralConstant {
+  static constexpr T value = V;
+};
+
+namespace NonTemplate {
+
+template <class T>
+// expected-error@+1 {{no member named 'flag'}}
+struct Trait : IntegralConstant<bool, T::flag> {};
+
+template <class D>
+struct CRTP {
+  // expected-note@+1 {{in instantiation of template class}}
+  template <typename EnableIf<Trait<D>::value>::type = 0>
+  void fn() const {}
+};
+
+// expected-note@+1 {{in instantiation of template class}}
+struct Derived : CRTP<Derived> {
+  static constexpr bool flag = true;
+};
+
----------------
zyn0217 wrote:

I think this is still incorrect, Derived definitely contains member `flag` and 
why should we diagnose `no member named 'flag'`?

This needs some thoughts: even before my patch, our diagnostics look very 
strange compared to GCC: https://godbolt.org/z/PWja3f9cf

I'd kindly ask you to *NOT* fix this with AI. This is probably harder than it 
looks like.


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

Reply via email to