re PR c++/58612 ([c++11] ICE calling non-constexpr from constexpr in template class)

PR c++/58612
	* tree.c (bot_replace): Only replace a dummy 'this' parm.

From-SVN: r212505
This commit is contained in:
Jason Merrill 2014-07-14 01:25:25 -04:00 committed by Jason Merrill
parent 7ce5ae457b
commit 22c6ea0042
3 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2014-07-13 Jason Merrill <jason@redhat.com>
PR c++/58612
* tree.c (bot_replace): Only replace a dummy 'this' parm.
PR c++/60628
* decl.c (create_array_type_for_decl): Only check for auto once.

View File

@ -2353,7 +2353,8 @@ bot_replace (tree* t, int* /*walk_subtrees*/, void* data)
*t = (tree) n->value;
}
else if (TREE_CODE (*t) == PARM_DECL
&& DECL_NAME (*t) == this_identifier)
&& DECL_NAME (*t) == this_identifier
&& !DECL_CONTEXT (*t))
{
/* In an NSDMI we need to replace the 'this' parameter we used for
parsing with the real one for this function. */

View File

@ -0,0 +1,15 @@
// PR c++/58612
// { dg-do compile { target c++11 } }
struct A
{
int foo() const { return 0; }
};
template<typename> struct B
{
A a;
constexpr int bar() { return a.foo(); } // { dg-error "foo" }
};
constexpr int i = B<void>().bar(); // { dg-error "bar" }