www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12122] New: Template with enumerated constant length array causes error.

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

           Summary: Template with enumerated constant length array causes
                    error.
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dy70swq+kzut3k sharklasers.com



PST ---
Created an attachment (id=1323)
Example D2 code to generate the error together with what causes it.

When foo function is used, compile time error is seen.

bugtesr.d(16): Error: template bugtesr.Test.foo does not match any function
template declaration. Candidates are:
bugtesr.d(4):        bugtesr.Test.foo(T)(in T[Test.DATA_LENGTH] msg) if (is(T :
ubyte) || is(T : char))
bugtesr.d(16): Error: template bugtesr.Test.foo(T)(in T[Test.DATA_LENGTH] msg)
if (is(T : ubyte) || is(T : char)) cannot deduce template function from
argument types !()(ubyte[16])


If the constant DATA_LENGTH is replaced with its real value 16, it works
without a problem.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12122


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



Reduced:


enum N = 1;
void foo(T)(T[N]) if(is(T == int)) {}
void main() {
    int[N] data;
    foo(data);
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12122


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
           Platform|x86_64                      |All
         OS/Version|Linux                       |All



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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 10 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12122




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d17d5f1e7de00abda58596efc2ab34b4e066dfb8
fix Issue 12122 - Template with enumerated constant length array causes error

https://github.com/D-Programming-Language/dmd/commit/788cef53e41b3753da49aab298a952172b9fb897


Issue 12122 - Template with enumerated constant length array causes error

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12122


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12122


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



14:28:40 PST ---
P.S. Kenji sorry for not closing these myself, when I set to auto-merge I tend
to do some other work and I miss the notification so the issue can be closed.

I guess we could use some kind of auto-close feature as well.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2014