From: Douglas Gregor Date: Wed, 26 Jan 2011 16:50:54 +0000 (+0000) Subject: Rvalue references for *this: tentative parsing and template argument deduction. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3c7a7ca66c02567543dbb5ec493818e00e8b177;p=clang Rvalue references for *this: tentative parsing and template argument deduction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124295 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 523054b2d8..35d72547cd 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -1222,6 +1222,10 @@ Parser::TPResult Parser::TryParseFunctionDeclarator() { Tok.is(tok::kw_restrict) ) ConsumeToken(); + // ref-qualifier[opt] + if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) + ConsumeToken(); + // exception-specification if (Tok.is(tok::kw_throw)) { ConsumeToken(); diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 70e9973946..fd12ccf0f2 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1154,11 +1154,11 @@ DeduceTemplateArguments(Sema &S, const FunctionProtoType *FunctionProtoParam = cast(Param); - if (FunctionProtoParam->getTypeQuals() != - FunctionProtoArg->getTypeQuals()) - return Sema::TDK_NonDeducedMismatch; - - if (FunctionProtoParam->isVariadic() != FunctionProtoArg->isVariadic()) + if (FunctionProtoParam->getTypeQuals() + != FunctionProtoArg->getTypeQuals() || + FunctionProtoParam->getRefQualifier() + != FunctionProtoArg->getRefQualifier() || + FunctionProtoParam->isVariadic() != FunctionProtoArg->isVariadic()) return Sema::TDK_NonDeducedMismatch; // Check return types. diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp new file mode 100644 index 0000000000..a9173fd6be --- /dev/null +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +// Deductions specific to C++0x. + +template +struct member_pointer_kind { + static const unsigned value = 0; +}; + +template +struct member_pointer_kind { + static const unsigned value = 1; +}; + +template +struct member_pointer_kind { + static const unsigned value = 2; +}; + +template +struct member_pointer_kind { + static const unsigned value = 3; +}; + +template +struct member_pointer_kind { + static const unsigned value = 4; +}; + +template +struct member_pointer_kind { + static const unsigned value = 5; +}; + +template +struct member_pointer_kind { + static const unsigned value = 6; +}; + +struct X { }; + +static_assert(member_pointer_kind::value == 1, ""); +static_assert(member_pointer_kind::value == 2, ""); +static_assert(member_pointer_kind::value == 3, ""); +static_assert(member_pointer_kind::value == 4, ""); +static_assert(member_pointer_kind::value == 5, ""); +static_assert(member_pointer_kind::value == 6, "");