aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-07-14 01:25:25 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-07-14 01:25:25 -0400
commit22c6ea004237e0dd3aebdfec3cbaad138bec06df (patch)
treea46bc4fe4cf82e362a248baa5cd252c9e0dfd201 /gcc
parent7ce5ae457b6843015074781a5a4d76a3765b2c1c (diff)
downloadgcc-22c6ea004237e0dd3aebdfec3cbaad138bec06df.zip
gcc-22c6ea004237e0dd3aebdfec3cbaad138bec06df.tar.gz
gcc-22c6ea004237e0dd3aebdfec3cbaad138bec06df.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/tree.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C15
3 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 45116eb..63f68dc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7ff5935..e782366 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
new file mode 100644
index 0000000..55bb838
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
@@ -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" }