]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/67114
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Aug 2015 22:01:12 +0000 (22:01 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Aug 2015 22:01:12 +0000 (22:01 +0000)
* call.c (joust): Only call more_constrained on decls.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226736 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp1z/regress1.C [new file with mode: 0644]

index a50804ae14b0261c5a6aa5dc5d846da27aaaafa2..40ed123c961c42f8015b07d00c3ba3e82f7de107 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-08  Jason Merrill  <jason@redhat.com>
+
+       PR c++/67114
+       * call.c (joust): Only call more_constrained on decls.
+
 2015-08-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
            Braden Obrzut  <admin@maniacsvault.net>
            Jason Merrill  <jason@redhat.com>
index 4823d37a9c40e187b43be14128d82c57c607c710..19ddb91e08fc53137c0e8a0a1fe7c0bb386574de 100644 (file)
@@ -9157,14 +9157,14 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
        return winner;
     }
 
-    // C++ Concepts
-    // or, if not that, F1 is more constrained than F2.
-    if (flag_concepts)
-      {
-        winner = more_constrained (cand1->fn, cand2->fn);
-        if (winner)
-          return winner;
-      }
+  // C++ Concepts
+  // or, if not that, F1 is more constrained than F2.
+  if (flag_concepts && DECL_P (cand1->fn) && DECL_P (cand2->fn))
+    {
+      winner = more_constrained (cand1->fn, cand2->fn);
+      if (winner)
+       return winner;
+    }
 
   /* Check whether we can discard a builtin candidate, either because we
      have two identical ones or matching builtin and non-builtin candidates.
diff --git a/gcc/testsuite/g++.dg/cpp1z/regress1.C b/gcc/testsuite/g++.dg/cpp1z/regress1.C
new file mode 100644 (file)
index 0000000..bbcca08
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/67114
+// { dg-options -std=c++1z }
+
+typedef unsigned uint32_t;
+class A {
+public:
+  void operator==(A);
+  operator uint32_t() const;
+  operator int() const;
+};
+class BluetoothNamedValue {
+  bool operator==(const BluetoothNamedValue &) const;
+  A value() const;
+};
+auto BluetoothNamedValue::
+operator==(const BluetoothNamedValue &) const -> bool {
+  value() == value();
+  return true;
+}