www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9143] New: template structs with two bool parameters confuse DMD

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9143

           Summary: template structs with two bool parameters confuse DMD
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puneet coverify.org



---
The following code does not compile. But starts compiling once the first line
of function noCall is commented out and the next two line which are logically
equivalent are uncommented.

It seems compile time parameters of type bool are not propagated well by
symbols in certain situations.

struct Foo (bool S, bool L) {
  auto noCall() {
    Foo!(S, false) x;        // compiles if this line commented
    // static if(S) Foo!(true, false) x;
    // else         Foo!(false, false) x;
  }
  this (T) (T other)        // constructor
  if (is (T unused == Foo!(P, Q), bool P, bool Q)) { }
}

void main() {
  Foo!(false, true) k = Foo!(false, false)();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9143




---
Earlier I thought the problem occurs for bool parameters. But it seems to be
more generic.

A more interesting test case:
1. Line 7 fails to compile.
2. There is no problem with line 4, 5, and 6.
3. If we uncomment line 3, compiler does not complain even for line 7.

struct Foo (bool L, size_t N) {
  void baaz () {
    // bar!(Foo!(false, 2LU))(); // line 3
    // bar!(Foo!(true, 2LU))();  // line 4
    // bar!(Foo!(L, N))();       // line 5
    // bar!(Foo!(true, N))();    // line 6
    bar!(Foo!(false, N))();      // line 7
  }
  void bar (T) ()
    if (is(T unused == Foo!(_L, _N), bool _L, size_t _N))
      {}
}

void main() {
  auto p = Foo!(true, 2LU)();
  p.baaz();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9143


Puneet Goel <puneet coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker



---
Since the problem seems to be more generic than I initially reported, and
because I am not finding any workarounds now, I am retagging the bug as
blocker.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9143


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/1368

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 12 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9143


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2012