diff options
author | Richard Smith <richard@metafoo.co.uk> | 2020-03-03 15:19:13 -0800 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-03-04 09:20:30 +0100 |
commit | 3a843031a5ad83a00d2603f623881cb2b2bf719d (patch) | |
tree | e41bf3bd9709fcde6adac546c900fa1752755d61 /clang/test/SemaTemplate/dependent-expr.cpp | |
parent | bca373f73fc82728a8335e7d6cd164e8747139ec (diff) | |
download | llvmorg-10.0.0-rc3.tar.gz |
PR45083: Mark statement expressions as being dependent if they appear inllvmorg-10.0.0-rc3
dependent contexts.
We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.
(cherry picked from commit bdad0a1b79273733df9acc1be4e992fa5d70ec56)
Diffstat (limited to 'clang/test/SemaTemplate/dependent-expr.cpp')
-rw-r--r-- | clang/test/SemaTemplate/dependent-expr.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/test/SemaTemplate/dependent-expr.cpp b/clang/test/SemaTemplate/dependent-expr.cpp index bb1e239c3490..e333ed927b9e 100644 --- a/clang/test/SemaTemplate/dependent-expr.cpp +++ b/clang/test/SemaTemplate/dependent-expr.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// expected-no-diagnostics // PR5908 template <typename Iterator> @@ -108,3 +107,22 @@ namespace PR18152 { }; template struct A<0>; } + +template<typename T> void stmt_expr_1() { + static_assert( ({ false; }), "" ); +} +void stmt_expr_2() { + static_assert( ({ false; }), "" ); // expected-error {{failed}} +} + +namespace PR45083 { + struct A { bool x; }; + + template<typename> struct B : A { + void f() { + const int n = ({ if (x) {} 0; }); + } + }; + + template void B<int>::f(); +} |