aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-06-20 14:31:53 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-06-20 14:31:53 -0400
commite2498d54f06c0bab7977047e5ab0277e69fc6319 (patch)
tree02b9e535de3aca28ce166a4982f4cb0c1dc399ac /gcc
parent73b3e61bca04df93fcba001702c469deeed6a06d (diff)
downloadgcc-e2498d54f06c0bab7977047e5ab0277e69fc6319.zip
gcc-e2498d54f06c0bab7977047e5ab0277e69fc6319.tar.gz
gcc-e2498d54f06c0bab7977047e5ab0277e69fc6319.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-template7.C32
3 files changed, 38 insertions, 1 deletions
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 <jason@redhat.com>
+
+ PR c++/61556
+ * call.c (build_over_call): Call build_this in template path.
+
2014-06-19 Jason Merrill <jason@redhat.com>
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 <int format>
+class ValueTypeInfo {
+};
+
+template <typename Format>
+class FillFunctor {
+public:
+ FillFunctor() {
+ ValueTypeInfo<ValueTypeEnum::doubleval> v;
+ }
+};
+
+int main() {
+ ValueTypeInfo<ValueTypeEnum::doubleval> v;
+}