diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/return.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 1c8a58b07ce..afd118e2caa 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1728,7 +1728,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, // cv-qualifiers on return types are pointless except when the type is a // class type in C++. - if (T->isPointerType() && T.getCVRQualifiers() && + if (isa<PointerType>(T) && T.getLocalCVRQualifiers() && (!getLangOptions().CPlusPlus || !T->isDependentType())) { assert(chunkIndex + 1 < e && "No DeclaratorChunk for the return type?"); DeclaratorChunk ReturnTypeChunk = D.getTypeObject(chunkIndex + 1); diff --git a/clang/test/SemaCXX/return.cpp b/clang/test/SemaCXX/return.cpp index 017633bce95..285fb09980e 100644 --- a/clang/test/SemaCXX/return.cpp +++ b/clang/test/SemaCXX/return.cpp @@ -41,3 +41,11 @@ char* volatile i(); // expected-warning{{'volatile' type qualifier on return typ const volatile int scalar_cv(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}} } + +namespace PR9328 { + typedef char *PCHAR; + class Test + { + const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}} + }; +} |