view clang/test/SemaCXX/inline.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children c4bab56944e8
line wrap: on
line source

// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wpre-c++17-compat

// 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}}

void localVar() {
  inline int a; // expected-error{{inline declaration of 'a' not allowed in block scope}}
}

// Check that we warn appropriately.
#if __cplusplus <= 201402L
inline int a; // expected-warning{{inline variables are a C++17 extension}}
#else
inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}}
#endif