From e2498d54f06c0bab7977047e5ab0277e69fc6319 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 20 Jun 2014 14:31:53 -0400 Subject: [PATCH] =?utf8?q?re=20PR=20c++/61556=20([c++11][4.9/4.10=20Regres?= =?utf8?q?sion]=20=E2=80=98*(const=20ValueType*)this=E2=80=99=20is=20not?= =?utf8?q?=20a=20constant=20expression=20with=20valid=20code)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/61556 * call.c (build_over_call): Call build_this in template path. From-SVN: r211853 --- gcc/cp/ChangeLog | 5 ++++ gcc/cp/call.c | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C | 32 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a992c87..b437954 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-20 Jason Merrill + + PR c++/61556 + * call.c (build_over_call): Call build_this in template path. + 2014-06-19 Jason Merrill PR c++/59296 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e147abd..da91433 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6896,7 +6896,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ++nargs; alcarray = XALLOCAVEC (tree, nargs); - alcarray[0] = first_arg; + alcarray[0] = build_this (first_arg); FOR_EACH_VEC_SAFE_ELT (args, ix, arg) alcarray[ix + 1] = arg; argarray = alcarray; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C new file mode 100644 index 0000000..e835dbf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C @@ -0,0 +1,32 @@ +// PR c++/61556 +// { dg-do compile { target c++11 } } + +class ValueType { +public: + constexpr operator int() const {return m_ID;}; + constexpr ValueType(const int v) + : m_ID(v) {} +private: + int m_ID; +}; + +class ValueTypeEnum { +public: + static constexpr ValueType doubleval = ValueType(1); +}; + +template +class ValueTypeInfo { +}; + +template +class FillFunctor { +public: + FillFunctor() { + ValueTypeInfo v; + } +}; + +int main() { + ValueTypeInfo v; +} -- 2.7.4