Skip to content

Commit

Permalink
[FOLD] add additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian committed May 7, 2024
1 parent a1450f2 commit 16ec4ae
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions clang/test/CXX/except/except.spec/p13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,30 @@ template<>
void f(A, int***); // expected-error {{'f<A, int>' is missing exception specification 'noexcept'}}

}

namespace N3 {

template<typename T, typename U>
void f(T, U) noexcept(T::y); // #1

template<typename T, typename U> // #2
void f(T, U*) noexcept(T::x);

// Deduction should succeed for both candidates, and #2 should be selected by overload resolution.
// Only the exception specification of #2 should be instantiated.
void (*x)(A, int*) = f;
}

namespace N4 {

template<typename T, typename U>
void f(T, U) noexcept(T::x); // #1

template<typename T, typename U>
void f(T, U*) noexcept(T::y); // #2
// expected-error@-1 {{no member named 'y' in 'A'}}

// Deduction should succeed for both candidates, and #2 should be selected by overload resolution.
// Only the exception specification of #2 should be instantiated.
void (*x)(A, int*) = f; // expected-note {{in instantiation of exception specification for 'f<A, int>' requested here}}
}

0 comments on commit 16ec4ae

Please sign in to comment.