Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/linkage-spec1.C

raw
1 // PR c++/107688
2 // P2615R1: Meaningful exports: Newly invalid declarations
3 // { dg-do compile { target c++11 } }
4
5 extern "C++" template <typename T> struct A {};
6
7 extern "C++" template <typename T> struct A<T*> {};
8
9 extern "C++" template <> struct A<int*> {};
10 // { dg-error "explicit specializations are not permitted here" "" { target c++20 } .-1 }
11
12 extern "C++" template struct A<int>;
13 // { dg-error "explicit instantiations are not permitted here" "" { target c++20 } .-1 }
14
15
16 // These should all still be valid, though
17 extern "C++" {
18 template <typename T> struct B {};
19 template <typename T> struct B<T*> {};
20 template <> struct B<int*> {};
21 template struct B<int>;
22 }