[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / constexpr-late-instantiation.cpp
blobec8e071217c1dae56581e23e0e5270752cda4f7d
1 // RUN: %clang_cc1 %s -fsyntax-only -verify
3 template <typename T>
4 constexpr T foo(T a); // expected-note {{declared here}}
6 int main() {
7 int k = foo<int>(5); // Ok
8 constexpr int j = // expected-error {{constexpr variable 'j' must be initialized by a constant expression}}
9 foo<int>(5); // expected-note {{undefined function 'foo<int>' cannot be used in a constant expression}}
12 template <typename T>
13 constexpr T foo(T a) {
14 return a;