D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 276 - Compiler erroneously thinks an aggregate inner template will add a field to it
Summary: Compiler erroneously thinks an aggregate inner template will add a field to it
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 major
Assignee: Walter Bright
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-08-02 17:22 UTC by Bruno Medeiros
Modified: 2021-05-28 01:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bruno Medeiros 2006-08-02 17:22:47 UTC
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.
Comment 1 Walter Bright 2006-08-11 19:18:21 UTC
Fixed DMD 0.164
Comment 2 Thomas Kühne 2006-08-14 06:50:37 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

-----BEGIN PGP SIGNATURE-----

iD8DBQFE4FS/LK5blCcjpWoRAm/jAJ4qBt6D29AekJwhg27ykgbcKUaP9ACfS1W1
2DkM7qkwh1PWM2cCPAvD/A0=
=siLP
-----END PGP SIGNATURE-----

Comment 3 Dlang Bot 2021-05-28 01:34:22 UTC
dlang/dlang-bot pull request #277 "Escape backticks with backslashes" was merged into master:

- 32e43a05f291699eb28d96f2b136bc975b78651f by Vladimir Panteleev:
  Escape backticks with backslashes
  
  Fixes #276.

https://github.com/dlang/dlang-bot/pull/277