annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wpre-c++17-compat
150
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // Check that we don't allow illegal uses of inline
anatofuz
parents:
diff changeset
6 // (checking C++-only constructs here)
anatofuz
parents:
diff changeset
7 struct c {inline int a;}; // expected-error{{'inline' can only appear on functions}}
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 void localVar() {
anatofuz
parents:
diff changeset
10 inline int a; // expected-error{{inline declaration of 'a' not allowed in block scope}}
anatofuz
parents:
diff changeset
11 }
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 // Check that we warn appropriately.
anatofuz
parents:
diff changeset
14 #if __cplusplus <= 201402L
anatofuz
parents:
diff changeset
15 inline int a; // expected-warning{{inline variables are a C++17 extension}}
anatofuz
parents:
diff changeset
16 #else
anatofuz
parents:
diff changeset
17 inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}}
anatofuz
parents:
diff changeset
18 #endif