1598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor// RUN: %clang_cc1 -fsyntax-only -verify %s 2598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 3598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregorstruct ConstCopy { 4598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor ConstCopy(); 5598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor ConstCopy(const ConstCopy&); 6598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 7598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 8598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregorstruct NonConstCopy { 9598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor NonConstCopy(); 10598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor NonConstCopy(NonConstCopy&); 11598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 12598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 13598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregorstruct VirtualInheritsNonConstCopy : virtual NonConstCopy { 14598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor VirtualInheritsNonConstCopy(); 15598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor VirtualInheritsNonConstCopy(const VirtualInheritsNonConstCopy&); 16598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 17598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 1879ab2c8104ef5df233d271560ccc734836738e56John McCallstruct ImplicitNonConstCopy1 : NonConstCopy { // expected-note {{candidate constructor}} 1979ab2c8104ef5df233d271560ccc734836738e56John McCall ImplicitNonConstCopy1(); // expected-note {{candidate constructor}} 20598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 21598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 2279ab2c8104ef5df233d271560ccc734836738e56John McCallstruct ImplicitNonConstCopy2 { // expected-note {{candidate constructor}} 2379ab2c8104ef5df233d271560ccc734836738e56John McCall ImplicitNonConstCopy2(); // expected-note {{candidate constructor}} 24598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor NonConstCopy ncc; 25598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 26598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 2779ab2c8104ef5df233d271560ccc734836738e56John McCallstruct ImplicitNonConstCopy3 { // expected-note {{candidate constructor}} 2879ab2c8104ef5df233d271560ccc734836738e56John McCall ImplicitNonConstCopy3(); // expected-note {{candidate constructor}} 29598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor NonConstCopy ncc_array[2][3]; 30598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 31598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 3279ab2c8104ef5df233d271560ccc734836738e56John McCallstruct ImplicitNonConstCopy4 : VirtualInheritsNonConstCopy { // expected-note {{candidate constructor}} 3379ab2c8104ef5df233d271560ccc734836738e56John McCall ImplicitNonConstCopy4(); // expected-note {{candidate constructor}} 34598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor}; 35598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor 36598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregorvoid test_non_const_copy(const ImplicitNonConstCopy1 &cincc1, 37598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor const ImplicitNonConstCopy2 &cincc2, 38598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor const ImplicitNonConstCopy3 &cincc3, 39598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor const ImplicitNonConstCopy4 &cincc4) { 4079ab2c8104ef5df233d271560ccc734836738e56John McCall (void)sizeof(ImplicitNonConstCopy1(cincc1)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy1' to 'ImplicitNonConstCopy1'}} 4179ab2c8104ef5df233d271560ccc734836738e56John McCall (void)sizeof(ImplicitNonConstCopy2(cincc2)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy2' to 'ImplicitNonConstCopy2'}} 4279ab2c8104ef5df233d271560ccc734836738e56John McCall (void)sizeof(ImplicitNonConstCopy3(cincc3)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy3' to 'ImplicitNonConstCopy3'}} 4379ab2c8104ef5df233d271560ccc734836738e56John McCall (void)sizeof(ImplicitNonConstCopy4(cincc4)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy4' to 'ImplicitNonConstCopy4'}} 44598a8543ec4c22e7f0a27e7ff2cf7e49cfa4e4ffDouglas Gregor} 45