typeid.cpp revision a5728872c7702ddd09537c95bc3cbd20e1f2fb09
1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s 2c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl 3c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlvoid f() 4c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl{ 5c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl (void)typeid(int); // expected-error {{error: you need to include <typeinfo> before using the 'typeid' operator}} 6c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl} 7c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl 8c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl// FIXME: This should really include <typeinfo>, but we don't have that yet. 9c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlnamespace std { 10c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl class type_info; 11c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl} 12c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl 13c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redlvoid g() 14c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl{ 15c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl (void)typeid(int); 16c42e1183846228a7fa5143ad76507d6d60f5c6f3Sebastian Redl} 17