re PR c++/79290 (forming pointer to member function tries to access "__pfn")

PR c++/79290
	* typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.

	PR c++/79290
	* g++.dg/warn/pr79290.C: New.

From-SVN: r245069
This commit is contained in:
Nathan Sidwell 2017-01-31 19:37:11 +00:00 committed by Nathan Sidwell
parent 0751254a75
commit 5ae37bdfce
4 changed files with 35 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2017-01-31 Nathan Sidwell <nathan@acm.org>
PR c++/79290
* typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
PR c++/67273
PR c++/79253
* pt.c: (instantiate_decl): Push to top level when current

View File

@ -2950,7 +2950,10 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
member = DECL_CHAIN (member))
if (DECL_NAME (member) == member_name)
break;
return build_simple_component_ref (ptrmem, member);
tree res = build_simple_component_ref (ptrmem, member);
TREE_NO_WARNING (res) = 1;
return res;
}
/* Given an expression PTR for a pointer, return an expression

View File

@ -1,5 +1,8 @@
2017-01-31 Nathan Sidwell <nathan@acm.org>
PR c++/79290
* g++.dg/warn/pr79290.C: New.
PR c++/67273
PR c++/79253
* g++.dg/cpp1y/pr67273.C: New.

View File

@ -0,0 +1,25 @@
// { dg-additional-options "-Wall" }
// PR 79290, bogus warning looking inside PMF
struct Song {
int get() const ;
};
typedef int (Song::*PMF_t)() const;
struct SongTag {
PMF_t function () const;
};
template<typename T>
struct Printer {
bool Foo(const SongTag &st) {
return st.function () == &Song::get;
}
};
void Baz (Printer<int> *p, SongTag const &st)
{
p->Foo (st);
}