18 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s2 3void f0() {4 int &ir = { 17 }; // expected-error{{reference to type 'int' cannot bind to an initializer list}}5}6 7namespace PR12453 {8 template<typename T>9 void f(int i) {10 T x{i}; // expected-error{{non-constant-expression cannot be narrowed from type 'int' to 'float' in initializer list}} \11 // expected-note{{insert an explicit cast to silence this issue}}12 T y{i}; // expected-error{{non-constant-expression cannot be narrowed from type 'int' to 'float' in initializer list}} \13 // expected-note{{insert an explicit cast to silence this issue}}14 }15 16 template void f<float>(int); // expected-note{{in instantiation of function template specialization 'PR12453::f<float>' requested here}}17}18