1 template <typename T> void specializable (T);
3 /* Invalid template: within "extern C". */
5 extern "C" { // { dg-message "1: 'extern .C.' linkage started here" }
7 template <typename T> // { dg-error "template with C linkage" }
8 void within_extern_c_braces (void);
12 /* Valid template: not within "extern C". */
15 void not_within_extern_c (void);
18 /* Invalid specialization: within "extern C". */
20 extern "C" { // { dg-message "1: 'extern .C.' linkage started here" }
22 template <> // { dg-error "template specialization with C linkage" }
23 void specializable (int);
28 /* Valid specialization: not within "extern C". */
30 void specializable (char);
33 /* Example of extern C without braces. */
35 extern "C" template <typename T> // { dg-line open_extern_c_no_braces }
36 void within_extern_c_no_braces (void);
37 // { dg-error "12: template with C linkage" "" { target *-*-* } open_extern_c_no_braces }
38 // { dg-message "1: 'extern .C.' linkage started here" "" { target *-*-* } open_extern_c_no_braces }
41 /* Nested extern "C" specifications.
42 We should report within the innermost extern "C" that's still open. */
45 extern "C" { // { dg-line middle_open_extern_c }
49 template <typename T> // { dg-error "template with C linkage" }
50 void within_nested_extern_c (void);
51 // { dg-message "3: 'extern .C.' linkage started here" "" { target *-*-* } middle_open_extern_c }
54 /* Valid template: within extern "C++". */
56 void within_nested_extern_cpp (void);
58 extern "C" { // { dg-line last_open_extern_c }
59 /* Invalid template: within "extern C". */
60 template <typename T> // { dg-error "template with C linkage" }
61 void within_extern_c_within_extern_cpp (void);
62 // { dg-message "7: 'extern .C.' linkage started here" "" { target *-*-* } last_open_extern_c }