diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-template10.C | 17 |
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(); +} |