blob: 5d61690c16e5e57127af3110f968d4b265544b25 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify
Anders Carlsson79cbc7d2009-11-14 21:45:58 +00002typedef const struct __CFString * CFStringRef;
3#define CFSTR __builtin___CFStringMakeConstantString
4
5void f() {
6 (void)CFStringRef(CFSTR("Hello"));
Daniel Dunbara5728872009-12-15 20:14:24 +00007}
Douglas Gregor85910982010-02-12 05:48:04 +00008
9void a() { __builtin_va_list x, y; ::__builtin_va_copy(x, y); }
Eli Friedmana6c66ce2012-08-31 00:14:07 +000010
11// <rdar://problem/10063539>
12template<int (*Compare)(const char *s1, const char *s2)>
13int equal(const char *s1, const char *s2) {
14 return Compare(s1, s2) == 0;
15}
16// FIXME: Our error recovery here sucks
17template int equal<&__builtin_strcmp>(const char*, const char*); // expected-error {{builtin functions must be directly called}} expected-error {{expected unqualified-id}} expected-error {{expected ')'}} expected-note {{to match this '('}}
18
19// PR13195
20void f2() {
21 __builtin_isnan; // expected-error {{builtin functions must be directly called}}
22}
Rafael Espindola508276c2013-01-12 15:27:43 +000023
24// pr14895
25typedef __typeof(sizeof(int)) size_t;
26extern "C" void *__builtin_alloca (size_t);