diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/SemaCXX/cxx1z-init-statement-template.cpp | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Vendor import of clang trunk r321017:vendor/clang/clang-trunk-r321017
Notes
Notes:
svn path=/vendor/clang/dist/; revision=326941
svn path=/vendor/clang/clang-trunk-r321017/; revision=326942; tag=vendor/clang/clang-trunk-r321017
Diffstat (limited to 'test/SemaCXX/cxx1z-init-statement-template.cpp')
-rw-r--r-- | test/SemaCXX/cxx1z-init-statement-template.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx1z-init-statement-template.cpp b/test/SemaCXX/cxx1z-init-statement-template.cpp new file mode 100644 index 000000000000..cedd2c720d90 --- /dev/null +++ b/test/SemaCXX/cxx1z-init-statement-template.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -std=c++1z -verify -emit-llvm-only %s +// expected-no-diagnostics + +// rdar://problem/33888545 +template <unsigned int BUFFER_SIZE> class Buffer {}; + +class A { +public: + int status; +}; + +template <unsigned int N> A parse(Buffer<N> buffer); + +template<unsigned int N> +void init_in_if(Buffer<N> buffer) { + if (A a = parse(buffer); a.status > 0) { + } +} + +template<unsigned int N> +void init_in_switch(Buffer<N> buffer) { + switch (A a = parse(buffer); a.status) { + default: + break; + } +} + +void test() { + Buffer<10> buffer; + init_in_if(buffer); + init_in_switch(buffer); +} |