Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / inline.cpp
bloba92e3993995171cd11693ca81d890f6b33e63f98
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17-compat -std=c++17 %s -Wpre-c++17-compat
5 // Check that we don't allow illegal uses of inline
6 // (checking C++-only constructs here)
7 struct c {inline int a;}; // expected-error{{'inline' can only appear on functions}}
9 void localVar() {
10 inline int a; // expected-error{{inline declaration of 'a' not allowed in block scope}}
13 // Check that we warn appropriately.
14 #if __cplusplus <= 201402L
15 inline int a; // expected-warning{{inline variables are a C++17 extension}}
16 #else
17 inline int a; // cxx17-compat-warning{{inline variables are incompatible with C++ standards before C++17}}
18 #endif