1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian 3249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanianstruct R { 4249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian R(int); 5249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian}; 6249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian 7249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanianstruct A { 8249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian A(R); 9249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian}; 10249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian 1185ea7aa961deac1d754f610af8062ae3f8b4e2a5Sebastian Redlstruct B { // expected-note 3 {{candidate constructor (the implicit copy constructor) not viable}} \ 1285ea7aa961deac1d754f610af8062ae3f8b4e2a5Sebastian Redl expected-note 3 {{candidate constructor (the implicit move constructor) not viable}} 1379ab2c8104ef5df233d271560ccc734836738e56John McCall B(A); // expected-note 3 {{candidate constructor not viable}} 14249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian}; 15249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian 16249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanianint main () { 1779ab2c8104ef5df233d271560ccc734836738e56John McCall B(10); // expected-error {{no matching conversion for functional-style cast from 'int' to 'B'}} 1879ab2c8104ef5df233d271560ccc734836738e56John McCall (B)10; // expected-error {{no matching conversion for C-style cast from 'int' to 'B'}} 1979ab2c8104ef5df233d271560ccc734836738e56John McCall static_cast<B>(10); // expected-error {{no matching conversion for static_cast from 'int' to 'B'}} \\ 201b2ad2fd9e2d5352144481aa1fd995d333d9adc9Argyrios Kyrtzidis // expected-warning {{expression result unused}} 21249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian} 22249ceade4942a2a5d7888541c547abeda5bb85b4Fariborz Jahanian 23b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregortemplate<class T> 24b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregorstruct X0 { 25b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor X0(const T &); 26b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor}; 27b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor 28b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregortemplate<class T> 29b653c52d9176a4faecf923f792758f4454f7f78cDouglas GregorX0<T> make_X0(const T &Val) { 30b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor return X0<T>(Val); 31b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor} 32b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor 33b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregorvoid test_X0() { 3460c93c9981c467738369702e7aa23fd58c2b6aacDouglas Gregor const char array[2] = { 'a', 'b' }; 35b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor make_X0(array); 36b653c52d9176a4faecf923f792758f4454f7f78cDouglas Gregor} 3727591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor 3827591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor// PR5210 recovery 3927591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregorclass C { 4027591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregorprotected: 4127591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor template <int> float* &f0(); // expected-note{{candidate}} 4227591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor template <unsigned> float* &f0(); // expected-note{{candidate}} 4327591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor 4427591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor void f1() { 4527591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor static_cast<float*>(f0<0>()); // expected-error{{ambiguous}} 4627591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor } 4727591ff4fc64600fd67c5d81899e3efe5ef41a80Douglas Gregor}; 48