================
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -ferror-limit 1 -verify %s
+
+template <typename T> struct S {
+  T val;
+  constexpr T get() const { return val; }
+};
+
+struct Bar {
+  template <typename T>
+  Bar(S<T> s) __attribute__((diagnose_if(s.get() == 1, "one", "error"))) {} // 
expected-note {{from 'diagnose_if'}}
+};
+void instantiated() { Bar{S<int>{1}}; } // expected-error {{one}}
+
+void bad(int i) __attribute__((diagnose_if(i, "bad", "error")));
+void blast() {
+  bad(1); // expected-error@* {{too many errors}}
+}
+
+struct Foo {
+  Foo(S<int> s) __attribute__((diagnose_if(s.get() == 1, "x", "warning"))) {}
+};
+void run() { Foo{S<int>{1}}; }
----------------
AaronBallman wrote:

This should diagnose with a warning: https://godbolt.org/z/q4aTzzc9W

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

Reply via email to