Thread overview
[Issue 12122] New: Template with enumerated constant length array causes error.
Feb 09, 2014
tcak
Feb 10, 2014
Kenji Hara
Feb 16, 2014
Kenji Hara
Feb 16, 2014
Andrej Mitrovic
February 09, 2014
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


--- Comment #0 from tcak <dy70swq+kzut3k@sharklasers.com> 2014-02-09 11:58:18 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: -------
February 09, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12122


bearophile_hugs@eml.cc changed:

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


--- Comment #1 from bearophile_hugs@eml.cc 2014-02-09 12:27:46 PST ---
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: -------
February 10, 2014
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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2014-02-10 00:10:37 PST ---
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: -------
February 16, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12122



--- Comment #3 from github-bugzilla@puremagic.com 2014-02-16 10:46:11 PST ---
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 Merge pull request #3242 from 9rnsr/fix12122

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: -------
February 16, 2014
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: -------
February 16, 2014
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


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2014-02-16 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: -------