[clang] [Clang] Drop dllexport/dllimport if conflicted with `exclude_from_explicit_instantiation` (PR #183515)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 26 06:53:10 PST 2026


================
@@ -0,0 +1,98 @@
+// RUN: %clang_cc1 -triple x86_64-win32 -fms-extensions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-mingw                 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-cygwin                -fsyntax-only -verify %s
+
+// Test that memberwise dllexport and dllimport are warned if the
+// exclude_from_explicit_instantiation attribute is attached.
+
+#define EXCLUDE_ATTR __attribute__((exclude_from_explicit_instantiation))
+
+template <class T>
+struct C {
+  EXCLUDE_ATTR __declspec(dllexport) void fn_excluded_exported();
+// expected-warning at -1{{'dllexport' attribute ignored; 'exclude_from_explicit_instantiation' takes precedence}}
----------------
zmodem wrote:

Same comment as on the other one: putting these directly on the lines they apply to make it easier to read.

https://github.com/llvm/llvm-project/pull/183515


More information about the cfe-commits mailing list