1 // RUN: %clang_cc1 -std=c++1z -verify -emit-llvm-only %s 2 // expected-no-diagnostics 3 4 // rdar://problem/33888545 5 template <unsigned int BUFFER_SIZE> class Buffer {}; 6 7 class A { 8 public: 9 int status; 10 }; 11 12 template <unsigned int N> A parse(Buffer<N> buffer); 13 14 template<unsigned int N> init_in_if(Buffer<N> buffer)15void init_in_if(Buffer<N> buffer) { 16 if (A a = parse(buffer); a.status > 0) { 17 } 18 } 19 20 template<unsigned int N> init_in_switch(Buffer<N> buffer)21void init_in_switch(Buffer<N> buffer) { 22 switch (A a = parse(buffer); a.status) { 23 default: 24 break; 25 } 26 } 27 test()28void test() { 29 Buffer<10> buffer; 30 init_in_if(buffer); 31 init_in_switch(buffer); 32 } 33