]>
Commit | Line | Data |
---|---|---|
9c30d598 JR |
1 | From 92d5303c23fcc698233b754fc8f180df1fa2aa9b Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> | |
3 | Date: Thu, 12 Feb 2015 17:37:57 +0100 | |
4 | Subject: [PATCH] Friend function template defined in a class cannot be used | |
5 | without ADL | |
6 | MIME-Version: 1.0 | |
7 | Content-Type: text/plain; charset=UTF-8 | |
8 | Content-Transfer-Encoding: 8bit | |
9 | ||
10 | GCC 5.0 stopped searching friend function templates without ADL. | |
11 | ||
12 | The Clause_new() function can be kept a friend but must be defined out | |
13 | of scope of the Clause class, or the callers must use fully | |
14 | qualificated name (Clause::Clause_new()) and the method must be | |
15 | changed from friend to static. | |
16 | ||
17 | So far my poor C++ knowledge. | |
18 | ||
19 | Signed-off-by: Petr Písař <ppisar@redhat.com> | |
20 | --- | |
21 | packages/swi-minisat2/C/Solver.C | 4 ++-- | |
22 | packages/swi-minisat2/C/SolverTypes.h | 2 +- | |
23 | 2 files changed, 3 insertions(+), 3 deletions(-) | |
24 | ||
25 | diff --git a/packages/swi-minisat2/C/Solver.C b/packages/swi-minisat2/C/Solver.C | |
26 | index 2de3e6d..1bcdbff 100644 | |
27 | --- a/packages/swi-minisat2/C/Solver.C | |
28 | +++ b/packages/swi-minisat2/C/Solver.C | |
29 | @@ -120,7 +120,7 @@ bool Solver::addClause(vec<Lit>& ps) | |
30 | uncheckedEnqueue(ps[0]); | |
31 | return ok = (propagate() == NULL); | |
32 | }else{ | |
33 | - Clause* c = Clause_new(ps, false); | |
34 | + Clause* c = Clause::Clause_new(ps, false); | |
35 | clauses.push(c); | |
36 | attachClause(*c); | |
37 | } | |
38 | @@ -599,7 +599,7 @@ lbool Solver::search(int nof_conflicts, int nof_learnts) | |
39 | if (learnt_clause.size() == 1){ | |
40 | uncheckedEnqueue(learnt_clause[0]); | |
41 | }else{ | |
42 | - Clause* c = Clause_new(learnt_clause, true); | |
43 | + Clause* c = Clause::Clause_new(learnt_clause, true); | |
44 | learnts.push(c); | |
45 | attachClause(*c); | |
46 | claBumpActivity(*c); | |
47 | diff --git a/packages/swi-minisat2/C/SolverTypes.h b/packages/swi-minisat2/C/SolverTypes.h | |
48 | index 47e3023..919b60b 100644 | |
49 | --- a/packages/swi-minisat2/C/SolverTypes.h | |
50 | +++ b/packages/swi-minisat2/C/SolverTypes.h | |
51 | @@ -119,7 +119,7 @@ public: | |
52 | ||
53 | // -- use this function instead: | |
54 | template<class V> | |
55 | - friend Clause* Clause_new(const V& ps, bool learnt = false) { | |
56 | + static Clause* Clause_new(const V& ps, bool learnt = false) { | |
57 | assert(sizeof(Lit) == sizeof(uint32_t)); | |
58 | assert(sizeof(float) == sizeof(uint32_t)); | |
59 | void* mem = malloc(sizeof(Clause) + sizeof(uint32_t)*(ps.size())); | |
60 | -- | |
61 | 1.9.3 | |
62 |