aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-04-15 12:32:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-04-15 12:32:22 -0400
commita7b12f1f3ed87fc36cf837862fca8477513446b4 (patch)
tree5016c36103b01b793e106809e0f2b8b6b923ffe6
parent26ad7ec736479bc315d33a59fb288d9be5c97d31 (diff)
downloadgcc-a7b12f1f3ed87fc36cf837862fca8477513446b4.zip
gcc-a7b12f1f3ed87fc36cf837862fca8477513446b4.tar.gz
gcc-a7b12f1f3ed87fc36cf837862fca8477513446b4.tar.bz2
re PR c++/70505 (Constexpr failure when template type specified)
PR c++/70505 * pt.c (tsubst_baselink): Give the new TEMPLATE_ID_EXPR unknown_type_node, too. From-SVN: r235042
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C17
3 files changed, 27 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cb09158..b159c9b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,4 +1,10 @@
2016-04-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/70505
+ * pt.c (tsubst_baselink): Give the new TEMPLATE_ID_EXPR
+ unknown_type_node, too.
+
+2016-04-15 Jason Merrill <jason@redhat.com>
Nathan Sidwell <nathan@acm.org>
PR c++/70594
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4a00530..325351f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13666,9 +13666,10 @@ tsubst_baselink (tree baselink, tree object_type,
/* Add back the template arguments, if present. */
if (BASELINK_P (baselink) && template_id_p)
BASELINK_FUNCTIONS (baselink)
- = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (baselink),
- template_args);
+ = build2 (TEMPLATE_ID_EXPR,
+ unknown_type_node,
+ BASELINK_FUNCTIONS (baselink),
+ template_args);
/* Update the conversion operator type. */
BASELINK_OPTYPE (baselink) = optype;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C
new file mode 100644
index 0000000..d63f1cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C
@@ -0,0 +1,17 @@
+// PR c++/70505
+// { dg-do compile { target c++11 } }
+
+template <class X>
+struct s
+{
+ template <class T>
+ static constexpr T f1(const T x) {return x;}
+ template <class T, T = f1<T>(sizeof(T))>
+ static constexpr T f2(const T x) {return x;}
+ static void f() {s<int>::f2(42);}
+};
+
+int main()
+{
+ s<int>::f();
+}