You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
change-namespace
clang-apply-replacements
clang-move
clang-query
clang-reorder-fields
clang-tidy
clang-tidy-vs
clangd
docs
include-fixer
modularize
pp-trace
test
Unit
change-namespace
clang-apply-replacements
clang-move
clang-query
clang-reorder-fields
clang-tidy
Inputs
android-cloexec-accept.cpp
android-cloexec-accept4.cpp
android-cloexec-creat.cpp
android-cloexec-dup.cpp
android-cloexec-epoll-create.cpp
android-cloexec-epoll-create1.cpp
android-cloexec-fopen.cpp
android-cloexec-inotify-init.cpp
android-cloexec-inotify-init1.cpp
android-cloexec-memfd-create.cpp
android-cloexec-open.cpp
android-cloexec-socket.cpp
basic.cpp
boost-use-to-string.cpp
bugprone-argument-comment-gmock.cpp
bugprone-argument-comment-strict.cpp
bugprone-argument-comment.cpp
bugprone-assert-side-effect.cpp
bugprone-bool-pointer-implicit-conversion.cpp
bugprone-copy-constructor-init.cpp
bugprone-dangling-handle.cpp
bugprone-fold-init-type.cpp
bugprone-forward-declaration-namespace.cpp
bugprone-inaccurate-erase.cpp
bugprone-integer-division.cpp
bugprone-misplaced-operator-in-strlen-in-alloc.c
bugprone-misplaced-operator-in-strlen-in-alloc.cpp
bugprone-move-forwarding-reference.cpp
bugprone-multiple-statement-macro.cpp
bugprone-string-constructor.cpp
bugprone-suspicious-memset-usage.cpp
bugprone-undefined-memory-manipulation.cpp
bugprone-use-after-move.cpp
bugprone-virtual-near-miss.cpp
cert-dcl21-cpp.cpp
cert-dcl58-cpp.cpp
cert-env33-c.c
cert-err34-c.c
cert-err34-c.cpp
cert-flp30-c.c
cert-limited-randomness.c
cert-limited-randomness.cpp
cert-oop11-cpp.cpp
cert-setlongjmp.cpp
cert-static-object-exception.cpp
cert-throw-exception-type.cpp
cert-variadic-function-def.cpp
check_clang_tidy.py
clang-tidy-diff.cpp
clang-tidy-run-with-database.cpp
clean-up-code.cpp
config-files.cpp
cppcoreguidelines-interfaces-global-init.cpp
cppcoreguidelines-no-malloc-custom.cpp
cppcoreguidelines-no-malloc-no-functions.cpp
cppcoreguidelines-no-malloc.cpp
cppcoreguidelines-owning-memory-containers.cpp
cppcoreguidelines-owning-memory-legacy-functions.cpp
cppcoreguidelines-owning-memory.cpp
cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
cppcoreguidelines-pro-bounds-constant-array-index-c++03.cpp
cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
cppcoreguidelines-pro-bounds-constant-array-index.cpp
cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp
cppcoreguidelines-pro-type-const-cast.cpp
cppcoreguidelines-pro-type-cstyle-cast.cpp
cppcoreguidelines-pro-type-member-init-cxx98.cpp
cppcoreguidelines-pro-type-member-init-delayed.cpp
cppcoreguidelines-pro-type-member-init.cpp
cppcoreguidelines-pro-type-reinterpret-cast.cpp
cppcoreguidelines-pro-type-static-cast-downcast.cpp
cppcoreguidelines-pro-type-union-access.cpp
cppcoreguidelines-pro-type-vararg.cpp
cppcoreguidelines-slicing.cpp
cppcoreguidelines-special-member-functions-cxx-03.cpp
cppcoreguidelines-special-member-functions-relaxed.cpp
cppcoreguidelines-special-member-functions.cpp
custom-diagnostics.cpp
deduplication.cpp
diagnostic.cpp
explain-checks.cpp
extra-args.cpp
file-filter.cpp
fix-errors.cpp
fix.cpp
fuchsia-default-arguments.cpp
fuchsia-overloaded-operator.cpp
fuchsia-virtual-inheritance.cpp
google-build-explicit-make-pair.cpp
google-default-arguments.cpp
google-explicit-constructor.cpp
google-module.cpp
google-namespaces.cpp
google-objc-avoid-throwing-exception.m
google-objc-global-variable-declaration.m
google-overloaded-unary-and.cpp
google-readability-casting.c
google-readability-casting.cpp
google-readability-namespace-comments.cpp
google-readability-todo.cpp
google-runtime-int-std.cpp
google-runtime-int.c
google-runtime-int.cpp
google-runtime-member-string-references.cpp
google-runtime-references.cpp
hicpp-exception-baseclass.cpp
hicpp-no-assembler-msvc.cpp
hicpp-no-assembler.cpp
hicpp-signed-bitwise-bug34747.cpp
hicpp-signed-bitwise-standard-types.cpp
hicpp-signed-bitwise-standard-types.h
hicpp-signed-bitwise.cpp
line-filter.cpp
list-checks.cpp
llvm-include-order.cpp
llvm-twine-local.cpp
macros.cpp
misc-definitions-in-headers-1z.hpp
misc-definitions-in-headers.hpp
misc-forwarding-reference-overload.cpp
misc-incorrect-roundings.cpp
misc-lambda-function-name.cpp
misc-macro-parentheses-cmdline.cpp
misc-macro-parentheses.cpp
misc-macro-repeated-side-effects.c
misc-misplaced-const.c
misc-misplaced-const.cpp
misc-misplaced-widening-cast-explicit-only.cpp
misc-misplaced-widening-cast-implicit-enabled.cpp
misc-new-delete-overloads-sized-dealloc.cpp
misc-new-delete-overloads.cpp
misc-non-copyable-objects.c
misc-non-copyable-objects.cpp
misc-redundant-expression.cpp
misc-sizeof-container.cpp
misc-sizeof-expression.cpp
misc-static-assert.c
misc-static-assert.cpp
misc-string-compare.cpp
misc-string-integer-assignment.cpp
misc-string-literal-with-embedded-nul.cpp
misc-suspicious-enum-usage-strict.cpp
misc-suspicious-enum-usage.cpp
misc-suspicious-missing-comma.cpp
misc-suspicious-semicolon-fail.cpp
misc-suspicious-semicolon.cpp
misc-suspicious-string-compare.c
misc-suspicious-string-compare.cpp
misc-swapped-arguments.cpp
misc-throw-by-value-catch-by-reference.cpp
misc-unconventional-assign-operator.cpp
misc-undelegated-constructor-cxx98.cpp
misc-undelegated-constructor.cpp
misc-uniqueptr-reset-release.cpp
misc-unused-alias-decls.cpp
misc-unused-parameters.c
misc-unused-parameters.cpp
misc-unused-raii.cpp
misc-unused-using-decls-errors.cpp
misc-unused-using-decls.cpp
modernize-avoid-bind.cpp
modernize-deprecated-headers-cxx03.cpp
modernize-deprecated-headers-cxx11.cpp
modernize-loop-convert-assert-failure.cpp
modernize-loop-convert-basic.cpp
modernize-loop-convert-camelback.cpp
modernize-loop-convert-const.cpp
modernize-loop-convert-extra.cpp
modernize-loop-convert-lowercase.cpp
modernize-loop-convert-negative.cpp
modernize-loop-convert-uppercase.cpp
modernize-loop-convert.c
modernize-make-shared-header.cpp
modernize-make-shared.cpp
modernize-make-unique-header.cpp
modernize-make-unique-macros.cpp
modernize-make-unique.cpp
modernize-pass-by-value-header.cpp
modernize-pass-by-value-macro-header.cpp
modernize-pass-by-value-multi-fixes.cpp
modernize-pass-by-value.cpp
modernize-raw-string-literal-delimiter.cpp
modernize-raw-string-literal-replace-shorter.cpp
modernize-raw-string-literal.cpp
modernize-redundant-void-arg-delayed.cpp
modernize-redundant-void-arg.c
modernize-redundant-void-arg.cpp
modernize-replace-auto-ptr.cpp
modernize-replace-random-shuffle.cpp
modernize-return-braced-init-list.cpp
modernize-shrink-to-fit.cpp
modernize-unary-static-assert.cpp
modernize-use-auto-cast-remove-stars.cpp
modernize-use-auto-cast.cpp
modernize-use-auto-iterator.cpp
modernize-use-auto-new-remove-stars.cpp
modernize-use-auto-new.cpp
modernize-use-bool-literals-ignore-macros.cpp
modernize-use-bool-literals.cpp
modernize-use-default-member-init-assignment.cpp
modernize-use-default-member-init-macros.cpp
modernize-use-default-member-init.cpp
modernize-use-emplace-ignore-implicit-constructors.cpp
modernize-use-emplace.cpp
modernize-use-equals-default-copy.cpp
modernize-use-equals-default-delayed.cpp
modernize-use-equals-default-macros.cpp
modernize-use-equals-default.cpp
modernize-use-equals-delete.cpp
modernize-use-noexcept-macro.cpp
modernize-use-noexcept-opt.cpp
modernize-use-noexcept.cpp
modernize-use-nullptr-basic.cpp
modernize-use-nullptr.c
modernize-use-nullptr.cpp
modernize-use-override-cxx98.cpp
modernize-use-override-ms.cpp
modernize-use-override.cpp
modernize-use-transparent-functors.cpp
modernize-use-using-macros.cpp
modernize-use-using.cpp
mpi-buffer-deref.cpp
mpi-type-mismatch.cpp
nolint.cpp
nolintnextline.cpp
nonstandard-file-extension.test
objc-arc-and-properties.m
objc-avoid-nserror-init.m
objc-avoid-spinlock.m
objc-forbidden-subclassing-custom.m
objc-forbidden-subclassing.m
objc-no-arc-or-properties.m
objc-property-declaration-custom.m
objc-property-declaration.m
overlapping.cpp
performance-faster-string-find.cpp
performance-for-range-copy-warn-on-all-auto-copies.cpp
performance-for-range-copy.cpp
performance-implicit-conversion-in-loop.cpp
performance-inefficient-algorithm.cpp
performance-inefficient-string-concatenation.cpp
performance-inefficient-vector-operation.cpp
performance-move-const-arg-trivially-copyable.cpp
performance-move-const-arg.cpp
performance-move-constructor-init.cpp
performance-noexcept-move-constructor.cpp
performance-type-promotion-in-math-fn.cpp
performance-unnecessary-copy-initialization.cpp
performance-unnecessary-value-param-delayed.cpp
performance-unnecessary-value-param-header.cpp
performance-unnecessary-value-param-incomplete-type.cpp
performance-unnecessary-value-param.cpp
readability-avoid-const-params-in-decls.cpp
readability-braces-around-statements-assert-failure.cpp
readability-braces-around-statements-few-lines.cpp
readability-braces-around-statements-format.cpp
readability-braces-around-statements-same-line.cpp
readability-braces-around-statements-single-line.cpp
readability-braces-around-statements.cpp
readability-container-size-empty.cpp
readability-delete-null-pointer.cpp
readability-deleted-default.cpp
readability-else-after-return.cpp
readability-function-size.cpp
readability-identifier-naming.cpp
readability-implicit-bool-conversion-allow-in-conditions.cpp
readability-implicit-bool-conversion-cxx98.cpp
readability-implicit-bool-conversion.cpp
readability-inconsistent-declaration-parameter-name.cpp
readability-misleading-indentation.cpp
readability-misplaced-array-index.cpp
readability-named-parameter.cpp
readability-non-const-parameter.cpp
readability-redundant-control-flow.cpp
readability-redundant-declaration-ignore-macros.cpp
readability-redundant-declaration.cpp
readability-redundant-function-ptr-dereference.cpp
readability-redundant-member-init.cpp
readability-redundant-smartptr-get.cpp
readability-redundant-string-cstr-msvc.cpp
readability-redundant-string-cstr.cpp
readability-redundant-string-init-msvc.cpp
readability-redundant-string-init.cpp
readability-simplify-bool-expr-chained-conditional-assignment.cpp
readability-simplify-bool-expr-chained-conditional-return.cpp
readability-simplify-bool-expr.cpp
readability-static-accessed-through-instance-nesting-threshold.cpp
readability-static-accessed-through-instance.cpp
readability-static-definition-in-anonymous-namespace.cpp
readability-uniqueptr-delete-release.cpp
select-checks.cpp
serialize-diagnostics.cpp
static-analyzer-config.cpp
static-analyzer.cpp
temporaries.cpp
validate-check-names.cpp
werrors-diagnostics.cpp
werrors-plural.cpp
werrors.cpp
clangd
include-fixer
modularize
pp-trace
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
tool-template
unittests
.arcconfig
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
LICENSE.TXT
README.txt
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
226 lines
8.9 KiB
C++
226 lines
8.9 KiB
C++
// RUN: clang-tidy %s -checks="-*,cert-err58-cpp" -- -std=c++11 -target x86_64-pc-linux-gnu \
|
|
// RUN: | FileCheck %s -check-prefix=CHECK-EXCEPTIONS \
|
|
// RUN: -implicit-check-not="{{warning|error}}:"
|
|
// RUN: clang-tidy %s -checks="-*,cert-err58-cpp" -- -fno-exceptions -std=c++11 -target x86_64-pc-linux-gnu \
|
|
// RUN: | FileCheck %s -allow-empty -check-prefix=CHECK-NONEXCEPTIONS \
|
|
// RUN: -implicit-check-not="{{warning|error}}:"
|
|
|
|
struct S {
|
|
S() noexcept(false);
|
|
};
|
|
|
|
struct T {
|
|
T() noexcept;
|
|
};
|
|
|
|
struct U {
|
|
U() {}
|
|
};
|
|
|
|
struct V {
|
|
explicit V(const char *) {} // Can throw
|
|
};
|
|
|
|
struct Cleanup {
|
|
~Cleanup() {}
|
|
};
|
|
|
|
struct W {
|
|
W(Cleanup c = {}) noexcept(false);
|
|
};
|
|
|
|
struct X {
|
|
X(S = {}) noexcept;
|
|
};
|
|
|
|
struct Y {
|
|
S s;
|
|
};
|
|
|
|
struct Z {
|
|
T t;
|
|
};
|
|
|
|
int f();
|
|
int g() noexcept(false);
|
|
int h() noexcept(true);
|
|
|
|
struct UserConv_Bad {
|
|
operator int() noexcept(false);
|
|
};
|
|
|
|
struct UserConv_Good {
|
|
operator int() noexcept;
|
|
};
|
|
|
|
UserConv_Bad some_bad_func() noexcept;
|
|
UserConv_Good some_good_func() noexcept;
|
|
|
|
S s;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 's' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
|
|
// CHECK-EXCEPTIONS: 9:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
T t; // ok
|
|
U u;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'u' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 17:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
V v("v");
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'v' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 21:12: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
W w;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'w' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 29:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
X x1(S{});
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'x1' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 9:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
X x2;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'x2' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 9:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
Y y;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'y' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 36:8: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
Z z;
|
|
|
|
int i = f();
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:5: warning: initialization of 'i' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 44:5: note: possibly throwing function declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
int j = g();
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:5: warning: initialization of 'j' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 45:5: note: possibly throwing function declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
int k = h();
|
|
int l = some_bad_func();
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:5: warning: initialization of 'l' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 49:3: note: possibly throwing function declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
int m = some_good_func();
|
|
|
|
typedef decltype(sizeof(int)) size_t;
|
|
inline void *operator new(size_t sz, void *here) noexcept { return here; }
|
|
char n[sizeof(int)];
|
|
int *o = new (n) int();
|
|
int *p = new int();
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:6: warning: initialization of 'p' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
|
|
thread_local S s3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 's3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local T t3; // ok
|
|
thread_local U u3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'u3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local V v3("v");
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'v3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local W w3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'w3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
|
|
void f(S s1, T t1, U u1, V v1, W w1) { // ok, ok, ok, ok, ok
|
|
S s2; // ok
|
|
T t2; // ok
|
|
U u2; // ok
|
|
V v2("v"); // ok
|
|
W w2; // ok
|
|
|
|
thread_local S s3; // ok
|
|
thread_local T t3; // ok
|
|
thread_local U u3; // ok
|
|
thread_local V v3("v"); // ok
|
|
thread_local W w3; // ok
|
|
|
|
static S s4; // ok
|
|
static T t4; // ok
|
|
static U u4; // ok
|
|
static V v4("v"); // ok
|
|
static W w4; // ok
|
|
}
|
|
|
|
namespace {
|
|
S s;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 's' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
|
|
// CHECK-EXCEPTIONS: 9:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
T t; // ok
|
|
U u;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'u' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 17:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
V v("v");
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'v' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 21:12: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
W w;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:3: warning: initialization of 'w' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 29:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
|
|
thread_local S s3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 's3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local T t3; // ok
|
|
thread_local U u3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'u3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local V v3("v");
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'v3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
thread_local W w3;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:16: warning: initialization of 'w3' with thread_local storage duration may throw an exception that cannot be caught
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
}; // namespace
|
|
|
|
class Statics {
|
|
static S s; // warn when initialized
|
|
static T t; // ok
|
|
static U u; // warn when initialized
|
|
static V v; // warn when initialized
|
|
static W w; // warn when initialized
|
|
|
|
void f(S s, T t, U u, V v) {
|
|
S s2; // ok
|
|
T t2; // ok
|
|
U u2; // ok
|
|
V v2("v"); // ok
|
|
W w2; // ok
|
|
|
|
thread_local S s3; // ok
|
|
thread_local T t3; // ok
|
|
thread_local U u3; // ok
|
|
thread_local V v3("v"); // ok
|
|
thread_local W w3; // ok
|
|
|
|
static S s4; // ok
|
|
static T t4; // ok
|
|
static U u4; // ok
|
|
static V v4("v"); // ok
|
|
static W w4; // ok
|
|
}
|
|
};
|
|
|
|
S Statics::s;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:12: warning: initialization of 's' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
|
|
// CHECK-EXCEPTIONS: 9:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
T Statics::t;
|
|
U Statics::u;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:12: warning: initialization of 'u' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 17:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
V Statics::v("v");
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:12: warning: initialization of 'v' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 21:12: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|
|
W Statics::w;
|
|
// CHECK-EXCEPTIONS: :[[@LINE-1]]:12: warning: initialization of 'w' with static storage duration may throw an exception that cannot be caught
|
|
// CHECK-EXCEPTIONS: 29:3: note: possibly throwing constructor declared here
|
|
// CHECK-NONEXCEPTIONS-NOT: warning:
|