xref: /llvm-project/clang/test/SemaTemplate/instantiate-typeof.cpp (revision 84a3aadf0f2483dde0acfc4e79f2a075a5f35bd1)
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2 
3 // Make sure we correctly treat __typeof as potentially-evaluated when appropriate
f(T n)4 template<typename T> void f(T n) { // expected-note {{declared here}}
5   int buffer[n]; // expected-warning {{variable length arrays in C++ are a Clang extension}} \
6                     expected-note {{function parameter 'n' with unknown value cannot be used in a constant expression}}
7   [&buffer] { __typeof(buffer) x; }();
8 }
main()9 int main() {
10   f<int>(1); // expected-note {{in instantiation of function template specialization 'f<int>' requested here}}
11 }
12