From: Jason Merrill Date: Fri, 20 Jun 2014 18:31:53 +0000 (-0400) Subject: re PR c++/61556 ([c++11][4.9/4.10 Regression] ‘*(const ValueType*)this’ is not a... X-Git-Tag: releases/gcc-5.1.0~6752 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2498d54f06c0bab7977047e5ab0277e69fc6319;p=thirdparty%2Fgcc.git re PR c++/61556 ([c++11][4.9/4.10 Regression] ‘*(const ValueType*)this’ is not a constant expression with valid code) PR c++/61556 * call.c (build_over_call): Call build_this in template path. From-SVN: r211853 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a992c87de858..b4379542510f 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 e147abdd0831..da9143300496 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 000000000000..e835dbf4db74 --- /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; +}