Ted Kremenek b79ee57080 Implemented delayed processing of 'unavailable' checking, just like with 'deprecated'.
Fixes <rdar://problem/15584219> and <rdar://problem/12241361>.

This change looks large, but all it does is reuse and consolidate
the delayed diagnostic logic for deprecation warnings with unavailability
warnings.  By doing so, it showed various inconsistencies between the
diagnostics, which were close, but not consistent.  It also revealed
some missing "note:"'s in the deprecated diagnostics that were showing
up in the unavailable diagnostics, etc.

This change also changes the wording of the core deprecation diagnostics.
Instead of saying "function has been explicitly marked deprecated"
we now saw "'X' has been been explicitly marked deprecated".  It
turns out providing a bit more context is useful, and often we
got the actual term wrong or it was not very precise
 (e.g., "function" instead of "destructor").  By just saying the name
of the thing that is deprecated/deleted/unavailable we define
this issue away.  This diagnostic can likely be further wordsmithed
to be shorter.

llvm-svn: 197627
2013-12-18 23:30:06 +00:00

58 lines
1.0 KiB
C++

// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fsyntax-only -verify %s
class X {
X(const X&);
public:
X();
X(X&&);
};
X return_by_move(int i, X x) {
X x2;
if (i == 0)
return x;
else if (i == 1)
return x2;
else
return x;
}
void throw_move_only(X x) {
X x2;
throw x;
throw x2;
}
namespace PR10142 {
struct X {
X();
X(X&&);
X(const X&) = delete; // expected-note 2{{'X' has been explicitly marked deleted here}}
};
void f(int i) {
X x;
try {
X x2;
if (i)
throw x2; // okay
throw x; // expected-error{{call to deleted constructor of 'PR10142::X'}}
} catch (...) {
}
}
template<typename T>
void f2(int i) {
T x;
try {
T x2;
if (i)
throw x2; // okay
throw x; // expected-error{{call to deleted constructor of 'PR10142::X'}}
} catch (...) {
}
}
template void f2<X>(int); // expected-note{{in instantiation of function template specialization 'PR10142::f2<PR10142::X>' requested here}}
}