brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · f7103a3 Raw
43 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5template <int> int f(int);  // expected-note {{candidate function}}6#if __cplusplus <= 199711L7// expected-note@-2 {{candidate function}}8#endif9 10template <signed char> int f(int); // expected-note {{candidate function}}11#if __cplusplus <= 199711L12// expected-note@-2 {{candidate function}}13#endif14 15int i1 = f<1>(0); // expected-error{{call to 'f' is ambiguous}}16int i2 = f<1000>(0);17#if __cplusplus <= 199711L18// expected-error@-2{{call to 'f' is ambiguous}}19#endif20 21namespace PR6707 {22  template<typename T, T Value>23  struct X { };24 25  template<typename T, T Value>26  void f(X<T, Value>);27 28  void g(X<int, 10> x) {29    f(x);30  }31 32  static const unsigned char ten = 10;33  template<typename T, T Value, typename U>34  void f2(X<T, Value>, X<U, Value>);35  // expected-note@-1 {{candidate template ignored: deduced values of conflicting types for parameter 'Value' (10 of type 'int' vs. 10 of type 'char')}}36  // expected-note@-2 {{candidate template ignored: deduced values of conflicting types for parameter 'Value' (10 of type 'char' vs. 10 of type 'int')}}37 38  void g2() {39    f2(X<int, 10>(), X<char, ten>()); // expected-error {{no matching}}40    f2(X<char, 10>(), X<int, ten>()); // expected-error {{no matching}}41  }42}43