forked from OSchip/llvm-project
Extend this test and make it a bit clearer which cases Clang is getting wrong.
llvm-svn: 284331
This commit is contained in:
parent
aa1370ac57
commit
ebb006e875
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -fsyntax-only %s
|
// RUN: %clang_cc1 -fsyntax-only %s -verify
|
||||||
|
|
||||||
struct AnyT {
|
struct AnyT {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -11,34 +11,54 @@ void test_cvqual_ref(AnyT any) {
|
||||||
|
|
||||||
struct AnyThreeLevelPtr {
|
struct AnyThreeLevelPtr {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
operator T***() const
|
operator T***() const {
|
||||||
{
|
T x = 0; // expected-note 2{{declared const here}}
|
||||||
T x = 0;
|
x = 0; // expected-error 2{{const-qualified type}}
|
||||||
// FIXME: looks like we get this wrong, too!
|
T ***p;
|
||||||
// x = 0; // will fail if T is deduced to a const type
|
return p;
|
||||||
// (EDG and GCC get this wrong)
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct X { };
|
struct X { };
|
||||||
|
|
||||||
void test_deduce_with_qual(AnyThreeLevelPtr a3) {
|
void test_deduce_with_qual(AnyThreeLevelPtr a3) {
|
||||||
int * const * const * const ip = a3;
|
int * const * const * const ip1 = a3;
|
||||||
|
// FIXME: This is wrong; we are supposed to deduce 'T = int' here.
|
||||||
|
const int * const * const * const ip2 = a3; // expected-note {{instantiation of}}
|
||||||
|
// This one is correct, though.
|
||||||
|
const double * * * ip3 = a3; // expected-note {{instantiation of}}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AnyPtrMem {
|
struct AnyPtrMem {
|
||||||
template<typename Class, typename T>
|
template<typename Class, typename T>
|
||||||
operator T Class::*() const
|
operator T Class::*() const
|
||||||
{
|
{
|
||||||
T x = 0;
|
// This is correct: we don't need a qualification conversion here, so we
|
||||||
// FIXME: looks like we get this wrong, too!
|
// deduce 'T = const float'.
|
||||||
// x = 0; // will fail if T is deduced to a const type.
|
T x = 0; // expected-note {{declared const here}}
|
||||||
// (EDG and GCC get this wrong)
|
x = 0; // expected-error {{const-qualified type}}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_deduce_ptrmem_with_qual(AnyPtrMem apm) {
|
void test_deduce_ptrmem_with_qual(AnyPtrMem apm) {
|
||||||
const float X::* pm = apm;
|
const float X::* pm = apm; // expected-note {{instantiation of}}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TwoLevelPtrMem {
|
||||||
|
template<typename Class1, typename Class2, typename T>
|
||||||
|
operator T Class1::*Class2::*() const
|
||||||
|
{
|
||||||
|
T x = 0; // expected-note 2{{declared const here}}
|
||||||
|
x = 0; // expected-error 2{{const-qualified type}}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void test_deduce_two_level_ptrmem_with_qual(TwoLevelPtrMem apm) {
|
||||||
|
// FIXME: This is wrong: we should deduce T = 'float'
|
||||||
|
const float X::* const X::* pm2 = apm; // expected-note {{instantiation of}}
|
||||||
|
// This is correct: we don't need a qualification conversion, so we directly
|
||||||
|
// deduce T = 'const double'
|
||||||
|
const double X::* X::* pm1 = apm; // expected-note {{instantiation of}}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue