Thread overview
[Issue 276] New: Compiler erroneously thinks an aggregate inner template will add a field to it
Aug 02, 2006
d-bugmail
Aug 12, 2006
d-bugmail
Aug 14, 2006
Thomas Kuehne
August 02, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=276

           Summary: Compiler erroneously thinks an aggregate inner template
                    will add a field to it
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: daiphoenix@lycos.com


Compiler erroneously thinks an aggregate inner template will add a field to it:

---
import BUGMultiDisFunction;

struct st {
        template t1() {
                template t2(int n2) { }
        }

}

alias st.t1!().t2 a;
---
Error:
" variable main.st.t1!().n2 cannot use template to add field to aggregate 'st'
"

This only happens because of the "int n2" parameter. If the parameter is a type, alias, or non-existent, there will be no compiler error.


-- 

August 12, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=276


bugzilla@digitalmars.com changed:

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




------- Comment #1 from bugzilla@digitalmars.com  2006-08-11 19:18 -------
Fixed DMD 0.164


-- 

August 14, 2006
d-bugmail@puremagic.com schrieb am 2006-08-02:
> http://d.puremagic.com/issues/show_bug.cgi?id=276

> Compiler erroneously thinks an aggregate inner template will add a field to it:
>
> ---
> import BUGMultiDisFunction;
>
> struct st {
>         template t1() {
>                 template t2(int n2) { }
>         }
>
> }
>
> alias st.t1!().t2 a;
> ---
> Error:
> " variable main.st.t1!().n2 cannot use template to add field to aggregate 'st'
> "
>
> This only happens because of the "int n2" parameter. If the parameter is a type, alias, or non-existent, there will be no compiler error.

http://dstress.kuehne.cn/compile/t/template_41_A.d http://dstress.kuehne.cn/compile/t/template_41_B.d http://dstress.kuehne.cn/compile/t/template_41_C.d http://dstress.kuehne.cn/compile/t/template_41_D.d http://dstress.kuehne.cn/compile/t/template_41_E.d http://dstress.kuehne.cn/compile/t/template_41_F.d http://dstress.kuehne.cn/compile/t/template_41_G.d http://dstress.kuehne.cn/compile/t/template_41_H.d

Thomas