37 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -fsyntax-only -verify -fms-compatibility -fexceptions -fcxx-exceptions2// RUN: %clang_cc1 -std=c++17 %s -fsyntax-only -verify -fms-compatibility -fexceptions -fcxx-exceptions3 4// FIXME: Should -fms-compatibility soften these errors into warnings to match5// MSVC? In practice, MSVC never implemented dynamic exception specifiers, so6// there isn't much Windows code in the wild that uses them.7#if __cplusplus >= 201703L8// expected-error@+3 {{ISO C++17 does not allow dynamic exception specifications}}9// expected-note@+2 {{use 'noexcept(false)' instead}}10#endif11void f() throw(...) { }12 13namespace PR28080 {14struct S; // expected-note {{forward declaration}}15#if __cplusplus >= 201703L16// expected-error@+3 {{ISO C++17 does not allow dynamic exception specifications}}17// expected-note@+2 {{use 'noexcept(false)' instead}}18#endif19void fn() throw(S); // expected-warning {{incomplete type}} expected-note{{previous declaration}}20void fn() throw(); // expected-warning {{does not match previous declaration}}21}22 23template <typename T> struct FooPtr {24 template <typename U> FooPtr(U *p) : m_pT(nullptr) {}25 26 template <>27 // FIXME: It would be better if this note pointed at the primary template28 // above.29 // expected-note@+1 {{previous declaration is here}}30 FooPtr(T *pInterface) throw() // expected-warning {{exception specification in declaration does not match previous declaration}}31 : m_pT(pInterface) {}32 33 T *m_pT;34};35struct Bar {};36template struct FooPtr<Bar>; // expected-note {{requested here}}37