Skip to content

Commit 16ec4ae

Browse files
committed
[FOLD] add additional test
1 parent a1450f2 commit 16ec4ae

File tree

1 file changed

+27
-0
lines changed
  • clang/test/CXX/except/except.spec

1 file changed

+27
-0
lines changed

clang/test/CXX/except/except.spec/p13.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,30 @@ template<>
7272
void f(A, int***); // expected-error {{'f<A, int>' is missing exception specification 'noexcept'}}
7373

7474
}
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+
}

0 commit comments

Comments
 (0)