Add a test for a diagnostic special case added in r148439, as requested by

Francois Pichet.

llvm-svn: 148784
This commit is contained in:
Richard Smith 2012-01-24 05:40:50 +00:00
parent 38d0d295ea
commit efc39b1d71
1 changed files with 19 additions and 0 deletions

View File

@ -1027,3 +1027,22 @@ namespace InstantiateCaseStmt {
template<int x> int g(int c) { switch(c) { case f<x>(): return 1; } return 0; }
int gg(int c) { return g<4>(c); }
}
namespace ConvertedConstantExpr {
extern int &m;
extern int &n;
constexpr int k = 4;
int &m = const_cast<int&>(k);
// If we have nothing more interesting to say, ensure we don't produce a
// useless note and instead just point to the non-constant subexpression.
enum class E {
em = m,
en = n, // expected-error {{not a constant expression}}
eo = (m +
n // expected-error {{not a constant expression}}
),
eq = reinterpret_cast<int>((int*)0) // expected-error {{not a constant expression}} expected-note {{reinterpret_cast}}
};
}