Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation bug with clang 3.4 #22

Open
msoos opened this issue Mar 26, 2015 · 4 comments
Open

Compilation bug with clang 3.4 #22

msoos opened this issue Mar 26, 2015 · 4 comments

Comments

@msoos
Copy link

msoos commented Mar 26, 2015

When compiling with clang 3.4 I get:

[..]minisat/minisat/core/SolverTypes.h:55:16: error: 
      friend declaration specifying a default argument must be a definition
    friend Lit mkLit(Var var, bool sign = false);
@tscheepers
Copy link

+1

@jon-whit
Copy link

Same issue here.

@johntyree
Copy link

This can be worked around by providing another definition for mkLit.

This patch compiles cleanly for me with clang-3.7.

diff --git a/minisat/core/SolverTypes.h b/minisat/core/SolverTypes.h
index 89986d1..9875f7f 100644
--- a/minisat/core/SolverTypes.h
+++ b/minisat/core/SolverTypes.h
@@ -52,7 +52,7 @@ struct Lit {
     int     x;

     // Use this as a constructor:
-    friend Lit mkLit(Var var, bool sign = false);
+    // friend Lit mkLit(Var var, bool sign) ;

     bool operator == (Lit p) const { return x == p.x; }
     bool operator != (Lit p) const { return x != p.x; }
@@ -60,6 +60,7 @@ struct Lit {
 };


+inline  Lit  mkLit     (Var var) { bool sign = false; Lit p; p.x = var + var + (int)sign; return p; }
 inline  Lit  mkLit     (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
 inline  Lit  operator ~(Lit p)              { Lit q; q.x = p.x ^ 1; return q; }
 inline  Lit  operator ^(Lit p, bool b)      { Lit q; q.x = p.x ^ (unsigned int)b; return q; }

@msoos
Copy link
Author

msoos commented Mar 19, 2016

@niklasso can you please fix this? I don't agree with the fix by @johntyree because it's not clean, but we can just set the default value in the declaration+definition instead of the friend declaration. Please.... it's breaking everything.

Thanks!

Mate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants