2011-02-28 03:40:07 +03:00
|
|
|
// RUN: %clang_cc1 %s -fcxx-exceptions -fexceptions -fsyntax-only -Wignored-qualifiers -verify
|
2009-07-23 03:56:57 +04:00
|
|
|
|
|
|
|
int test1() {
|
|
|
|
throw;
|
|
|
|
}
|
2009-10-02 03:25:31 +04:00
|
|
|
|
|
|
|
// PR5071
|
|
|
|
template<typename T> T f() { }
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void g(T t) {
|
|
|
|
return t * 2; // okay
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
T h() {
|
|
|
|
return 17;
|
|
|
|
}
|
2010-07-14 10:36:18 +04:00
|
|
|
|
|
|
|
// Don't warn on cv-qualified class return types, only scalar return types.
|
|
|
|
namespace ignored_quals {
|
|
|
|
struct S {};
|
|
|
|
const S class_c();
|
|
|
|
const volatile S class_cv();
|
|
|
|
|
|
|
|
const int scalar_c(); // expected-warning{{'const' type qualifier on return type has no effect}}
|
2011-02-23 21:51:59 +03:00
|
|
|
int const scalar_c2(); // expected-warning{{'const' type qualifier on return type has no effect}}
|
|
|
|
|
|
|
|
const
|
|
|
|
char*
|
|
|
|
const // expected-warning{{'const' type qualifier on return type has no effect}}
|
|
|
|
f();
|
|
|
|
|
|
|
|
char
|
|
|
|
const*
|
|
|
|
const // expected-warning{{'const' type qualifier on return type has no effect}}
|
|
|
|
g();
|
|
|
|
|
|
|
|
char* const h(); // expected-warning{{'const' type qualifier on return type has no effect}}
|
|
|
|
char* volatile i(); // expected-warning{{'volatile' type qualifier on return type has no effect}}
|
|
|
|
|
2010-07-14 10:36:18 +04:00
|
|
|
const volatile int scalar_cv(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
|
|
|
|
}
|
2011-03-01 20:04:42 +03:00
|
|
|
|
|
|
|
namespace PR9328 {
|
|
|
|
typedef char *PCHAR;
|
|
|
|
class Test
|
|
|
|
{
|
|
|
|
const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
|
|
|
|
};
|
|
|
|
}
|
2011-03-11 07:56:58 +03:00
|
|
|
|
|
|
|
class foo {
|
|
|
|
operator int * const ();
|
|
|
|
};
|
2011-06-01 11:44:31 +04:00
|
|
|
|
|
|
|
namespace PR10057 {
|
|
|
|
struct S {
|
|
|
|
~S();
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class VarType>
|
|
|
|
void Test(const VarType& value) {
|
|
|
|
return S() = value;
|
|
|
|
}
|
|
|
|
}
|