2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2016-07-15 06:22:58 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
|
2021-03-17 19:51:54 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wpre-c++17-compat
|
2009-04-08 03:37:57 +08:00
|
|
|
|
|
|
|
// Check that we don't allow illegal uses of inline
|
|
|
|
// (checking C++-only constructs here)
|
|
|
|
struct c {inline int a;}; // expected-error{{'inline' can only appear on functions}}
|
2016-07-15 06:22:58 +08:00
|
|
|
|
|
|
|
void localVar() {
|
|
|
|
inline int a; // expected-error{{inline declaration of 'a' not allowed in block scope}}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that we warn appropriately.
|
|
|
|
#if __cplusplus <= 201402L
|
2017-08-14 06:26:53 +08:00
|
|
|
inline int a; // expected-warning{{inline variables are a C++17 extension}}
|
2016-07-15 06:22:58 +08:00
|
|
|
#else
|
2017-08-14 06:26:53 +08:00
|
|
|
inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}}
|
2016-07-15 06:22:58 +08:00
|
|
|
#endif
|