From: Sebastian Redl Date: Wed, 3 Feb 2010 19:36:07 +0000 (+0000) Subject: Top-level const changes do not make a qualification conversion. Fixes PR6089. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22c92406f4b043bd872b53761f6a157fcc105594;p=clang Top-level const changes do not make a qualification conversion. Fixes PR6089. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95239 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index d1d9bda93e..1319f337a6 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1421,7 +1421,7 @@ Sema::IsQualificationConversion(QualType FromType, QualType ToType) { // If FromType and ToType are the same type, this is not a // qualification conversion. - if (FromType == ToType) + if (FromType.getUnqualifiedType() == ToType.getUnqualifiedType()) return false; // (C++ 4.4p4): diff --git a/test/CXX/conv/conv.qual/pr6089.cpp b/test/CXX/conv/conv.qual/pr6089.cpp new file mode 100644 index 0000000000..ae75ec41bd --- /dev/null +++ b/test/CXX/conv/conv.qual/pr6089.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +bool is_char_ptr( const char* ); + +template< class T > + long is_char_ptr( T /* r */ ); + +// Note: the const here does not lead to a qualification conversion +template< class T > + void make_range( T* const r, bool ); + +template< class T > + void make_range( T& r, long ); + +void first_finder( const char*& Search ) +{ + make_range( Search, is_char_ptr(Search) ); +}