8086027: Multiple STATIC_ASSERTs at class scope doesn't work

Make supporting typedef name unique via __LINE__ concatenation

Reviewed-by: dholmes, brutisso
This commit is contained in:
Kim Barrett 2015-06-09 15:05:47 -04:00
parent f286447281
commit 4bbbdd7aa6
3 changed files with 39 additions and 1 deletions

View file

@ -770,3 +770,31 @@ extern "C" void pns(void* sp, void* fp, void* pc) { // print native stack
}
#endif // !PRODUCT
//////////////////////////////////////////////////////////////////////////////
// Test multiple STATIC_ASSERT forms in various scopes.
#ifndef PRODUCT
// namespace scope
STATIC_ASSERT(true);
STATIC_ASSERT(true);
STATIC_ASSERT(1 == 1);
STATIC_ASSERT(0 == 0);
void test_multiple_static_assert_forms_in_function_scope() {
STATIC_ASSERT(true);
STATIC_ASSERT(true);
STATIC_ASSERT(0 == 0);
STATIC_ASSERT(1 == 1);
}
// class scope
struct TestMultipleStaticAssertFormsInClassScope {
STATIC_ASSERT(true);
STATIC_ASSERT(true);
STATIC_ASSERT(0 == 0);
STATIC_ASSERT(1 == 1);
};
#endif // !PRODUCT