Clang Project

clang_source_code/test/Frontend/trigraphs.cpp
1// RUN: %clang_cc1 -DSTDCPP11 -std=c++11 -verify -fsyntax-only %s
2// RUN: %clang_cc1 -DSTDGNU11 -std=gnu++11 -verify -fsyntax-only %s
3// RUN: %clang_cc1 -DSTDGNU11TRI -ftrigraphs -std=gnu++11 -verify -fsyntax-only %s
4// RUN: %clang_cc1 -DSTDCPP17 -std=c++1z -verify -fsyntax-only %s
5// RUN: %clang_cc1 -DSTDCPP17TRI -ftrigraphs -std=c++1z -verify -fsyntax-only %s
6// RUN: %clang_cc1 -DMSCOMPAT -fms-compatibility -std=c++11 -verify -fsyntax-only %s
7
8void foo() {
9#if defined(NOFLAGS) || defined(STDCPP11) || defined(STDGNU11TRI) || \
10    defined(STDCPP17TRI)
11  const char c[] = "??/n"; // expected-warning{{trigraph converted to '\' character}}
12#elif defined(STDGNU11) || defined(STDCPP17) || defined(MSCOMPAT)
13  const char c[] = "??/n"; // expected-warning{{trigraph ignored}}
14#else
15#error Not handled.
16#endif
17}
18