[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / instantiate-typeof.cpp
blobbc6027fad2b429079a2ca690db94cdf6bf0c5051
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 // Make sure we correctly treat __typeof as potentially-evaluated when appropriate
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; }();
9 int main() {
10 f<int>(1); // expected-note {{in instantiation of function template specialization 'f<int>' requested here}}