* constexpr.c (cxx_eval_constant_expression): Handle PTRMEM_CSTs
wrapped in NOP_EXPRs.
* g++.dg/pr69379.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232882
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-01-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69379
+ * constexpr.c (cxx_eval_constant_expression): Handle PTRMEM_CSTs
+ wrapped in NOP_EXPRs.
+
2016-01-27 Martin Sebor <msebor@redhat.com>
PR c++/69317
if (TREE_CODE (op) == PTRMEM_CST
&& !TYPE_PTRMEM_P (type))
op = cplus_expand_constant (op);
+ if (TREE_CODE (op) == PTRMEM_CST && tcode == NOP_EXPR)
+ {
+ if (same_type_ignoring_top_level_qualifiers_p (type,
+ TREE_TYPE (op)))
+ STRIP_NOPS (t);
+ else
+ {
+ if (!ctx->quiet)
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
+ "a reinterpret_cast is not a constant-expression");
+ *non_constant_p = true;
+ return t;
+ }
+ }
if (POINTER_TYPE_P (type)
&& TREE_CODE (op) == INTEGER_CST
&& !integer_zerop (op))
+2016-01-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69379
+ * g++.dg/pr69379.C: New test.
+
2016-01-27 Martin Sebor <msebor@redhat.com>
PR c++/69317
--- /dev/null
+// PR c++/69379
+// { dg-do compile }
+// { dg-options "-Wformat" }
+
+typedef int T;
+class A {
+public:
+ template <class D> A(const char *, D);
+ template <class Fn, class A1, class A2>
+ void m_fn1(const char *, Fn, A1 const &, A2);
+};
+struct Dict {
+ void m_fn2();
+};
+void fn1() {
+ A a("", "");
+ typedef void *Get;
+ typedef void (Dict::*d)(T);
+ a.m_fn1("", Get(), d(&Dict::m_fn2), "");
+}