p9-0x.cpp revision 762bb9d0ad20320b9f97a841dce57ba5e8e48b07
1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 21e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor 31e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregorenum class EC { ec1 }; 41e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor 51e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregorvoid test0(EC ec) { 61e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<bool>(ec); 71e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<bool>(EC::ec1); 81e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<char>(ec); 91e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<char>(EC::ec1); 101e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<int>(ec); 111e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<int>(EC::ec1); 121e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<unsigned long>(ec); 131e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<unsigned long>(EC::ec1); 141e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<float>(ec); 151e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<float>(EC::ec1); 161e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<double>(ec); 171e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor (void)static_cast<double>(EC::ec1); 181e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor} 191e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor 201e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregornamespace PR9107 { 211e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor enum E {}; 221e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor template <class _Tp> inline _Tp* addressof(_Tp& __x) { 231e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor return (_Tp*)&(char&)__x; 241e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor } 251e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor void test() { 261e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor E a; 271e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor addressof(a); 281e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor } 291e856d99c52d9e93eab48084c3aca4a59204b94bDouglas Gregor} 30