File tree 1 file changed +27
-0
lines changed
clang/test/CXX/except/except.spec
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -72,3 +72,30 @@ template<>
72
72
void f (A, int ***); // expected-error {{'f<A, int>' is missing exception specification 'noexcept'}}
73
73
74
74
}
75
+
76
+ namespace N3 {
77
+
78
+ template <typename T, typename U>
79
+ void f (T, U) noexcept (T::y); // #1
80
+
81
+ template <typename T, typename U> // #2
82
+ void f (T, U*) noexcept (T::x);
83
+
84
+ // Deduction should succeed for both candidates, and #2 should be selected by overload resolution.
85
+ // Only the exception specification of #2 should be instantiated.
86
+ void (*x)(A, int *) = f;
87
+ }
88
+
89
+ namespace N4 {
90
+
91
+ template <typename T, typename U>
92
+ void f (T, U) noexcept (T::x); // #1
93
+
94
+ template <typename T, typename U>
95
+ void f (T, U*) noexcept (T::y); // #2
96
+ // expected-error@-1 {{no member named 'y' in 'A'}}
97
+
98
+ // Deduction should succeed for both candidates, and #2 should be selected by overload resolution.
99
+ // Only the exception specification of #2 should be instantiated.
100
+ void (*x)(A, int *) = f; // expected-note {{in instantiation of exception specification for 'f<A, int>' requested here}}
101
+ }
You can’t perform that action at this time.
0 commit comments