blob: d3a2a28deb8b8b4a918aca9b55ee76141c2be4f9 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Sebastian Redlc42e1182008-11-11 11:37:55 +00002
3void f()
4{
Richard Trieu2fe9b7f2011-12-15 00:38:15 +00005 (void)typeid(int); // expected-error {{you need to include <typeinfo> before using the 'typeid' operator}}
Sebastian Redlc42e1182008-11-11 11:37:55 +00006}
7
Sebastian Redlc42e1182008-11-11 11:37:55 +00008namespace std {
9 class type_info;
10}
11
12void g()
13{
14 (void)typeid(int);
15}
Douglas Gregor765ccba2009-12-23 21:06:06 +000016
17struct X; // expected-note 3{{forward declaration}}
18
19void g1(X &x) {
John McCall7c2342d2010-03-10 11:27:22 +000020 (void)typeid(X); // expected-error{{'typeid' of incomplete type 'X'}}
21 (void)typeid(X&); // expected-error{{'typeid' of incomplete type 'X'}}
22 (void)typeid(x); // expected-error{{'typeid' of incomplete type 'X'}}
Douglas Gregor765ccba2009-12-23 21:06:06 +000023}