[PATCH] MS ABI: Propagate class-level DLL attributes to class template specialization bases (PR11170)

Hans Wennborg hans at chromium.org
Wed Jun 25 11:37:18 PDT 2014

Comment at: lib/Sema/SemaDeclCXX.cpp:1310
@@ +1309,3 @@
+  if (BaseTemplateSpec->getSpecializationKind() != TSK_Undeclared) {
+    bool DifferentAttribute = false;
Reid Kleckner wrote:
> Can you return early if getSpecializationKind() == TSK_Undeclared to reduce indentation?

Comment at: lib/Sema/SemaDeclCXX.cpp:1326-1328
@@ +1325,5 @@
+    // The template was previously instantiated or explicitly specialized
+    // without, or with the wrong kind of, dll attribute. It's too late for us
+    // to change the attribute, so warn that this is unsupported.
+    S.Diag(BaseLoc, diag::warn_attribute_dll_instantiated_base_class)
Reid Kleckner wrote:
> I think one of the 4 cases you have here is impossible.  An explicitly specialized template will never have a different dll attribute, because it can only have an explicit, non-inherited attribute, in which case we won't try to change the dll attribute.  What do you think of this for the first sentence:
> The template was previously instantiated or explicitly specialized without a dll attribute, or the template was previously instantiated with a different inherited dll attribute.
Sounds good to me. Done.


More information about the cfe-commits mailing list