annotate gcc/testsuite/g++.dg/template/extern-c.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 template <typename T> void specializable (T);
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* Invalid template: within "extern C". */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 extern "C" { // { dg-message "1: 'extern .C.' linkage started here" }
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 template <typename T> // { dg-error "template with C linkage" }
kono
parents:
diff changeset
8 void within_extern_c_braces (void);
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 }
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 /* Valid template: not within "extern C". */
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 template <typename T>
kono
parents:
diff changeset
15 void not_within_extern_c (void);
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 /* Invalid specialization: within "extern C". */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 extern "C" { // { dg-message "1: 'extern .C.' linkage started here" }
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 template <> // { dg-error "template specialization with C linkage" }
kono
parents:
diff changeset
23 void specializable (int);
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 }
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 /* Valid specialization: not within "extern C". */
kono
parents:
diff changeset
29 template <>
kono
parents:
diff changeset
30 void specializable (char);
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 /* Example of extern C without braces. */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 extern "C" template <typename T> // { dg-line open_extern_c_no_braces }
kono
parents:
diff changeset
36 void within_extern_c_no_braces (void);
kono
parents:
diff changeset
37 // { dg-error "12: template with C linkage" "" { target *-*-* } open_extern_c_no_braces }
kono
parents:
diff changeset
38 // { dg-message "1: 'extern .C.' linkage started here" "" { target *-*-* } open_extern_c_no_braces }
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 /* Nested extern "C" specifications.
kono
parents:
diff changeset
42 We should report within the innermost extern "C" that's still open. */
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 extern "C" {
kono
parents:
diff changeset
45 extern "C" { // { dg-line middle_open_extern_c }
kono
parents:
diff changeset
46 extern "C" {
kono
parents:
diff changeset
47 }
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 template <typename T> // { dg-error "template with C linkage" }
kono
parents:
diff changeset
50 void within_nested_extern_c (void);
kono
parents:
diff changeset
51 // { dg-message "3: 'extern .C.' linkage started here" "" { target *-*-* } middle_open_extern_c }
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 extern "C++" {
kono
parents:
diff changeset
54 /* Valid template: within extern "C++". */
kono
parents:
diff changeset
55 template <typename T>
kono
parents:
diff changeset
56 void within_nested_extern_cpp (void);
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 extern "C" { // { dg-line last_open_extern_c }
kono
parents:
diff changeset
59 /* Invalid template: within "extern C". */
kono
parents:
diff changeset
60 template <typename T> // { dg-error "template with C linkage" }
kono
parents:
diff changeset
61 void within_extern_c_within_extern_cpp (void);
kono
parents:
diff changeset
62 // { dg-message "7: 'extern .C.' linkage started here" "" { target *-*-* } last_open_extern_c }
kono
parents:
diff changeset
63 }
kono
parents:
diff changeset
64 }
kono
parents:
diff changeset
65 }
kono
parents:
diff changeset
66 }