brintos

brintos / llvm-project-archived public Read only

0
0
Text · 545 B · 9aec0c9 Raw
17 lines · cpp
1// RUN: %clang_cc1 %s -fsyntax-only -verify2// RUN: %clang_cc1 %s -fexperimental-new-constant-interpreter -fsyntax-only -verify3 4template <typename T>5constexpr T foo(T a);   // expected-note {{declared here}}6 7int main() {8  int k = foo<int>(5);  // Ok9  constexpr int j =     // expected-error {{constexpr variable 'j' must be initialized by a constant expression}}10          foo<int>(5);  // expected-note {{undefined function 'foo<int>' cannot be used in a constant expression}}11}12 13template <typename T>14constexpr T foo(T a) {15  return a;16}17