// RUN: %clang_cc1 -fsyntax-only -verify %s // Test that we properly merge the exclude_from_explicit_instantiation // attribute on redeclarations. #define EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((exclude_from_explicit_instantiation)) template struct Foo { // Declaration without the attribute, definition with the attribute. void func1(); // Declaration with the attribute, definition without the attribute. EXCLUDE_FROM_EXPLICIT_INSTANTIATION void func2(); // Declaration with the attribute, definition with the attribute. EXCLUDE_FROM_EXPLICIT_INSTANTIATION void func3(); }; template EXCLUDE_FROM_EXPLICIT_INSTANTIATION void Foo::func1() { using Fail = typename T::invalid; // expected-error{{no type named 'invalid' in 'Empty'}} } template void Foo::func2() { using Fail = typename T::invalid; // expected-error{{no type named 'invalid' in 'Empty'}} } template EXCLUDE_FROM_EXPLICIT_INSTANTIATION void Foo::func3() { using Fail = typename T::invalid; // expected-error{{no type named 'invalid' in 'Empty'}} } struct Empty { }; extern template struct Foo; int main() { Foo foo; foo.func1(); // expected-note{{in instantiation of}} foo.func2(); // expected-note{{in instantiation of}} foo.func3(); // expected-note{{in instantiation of}} }