[Issue 8944] New: Loosing const from shared const type when unqualifying in foreach over tuple
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 2 10:34:55 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8944
Summary: Loosing const from shared const type when unqualifying
in foreach over tuple
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-02 20:34:54 MSK ---
---
template TypeTuple(TList...)
{ alias TList TypeTuple; }
void main()
{
foreach(T; TypeTuple!(shared void*, const shared void*))
{
static if (is(T U == shared const U)) alias U TU;
else static if (is(T U == shared U)) alias U TU;
else static assert(0);
pragma(msg, "T: ", T, "\nTU: ", TU, "\n");
static if(is(T P == P*))
static if(is(TU PU == PU*))
static assert(is(P == PU)); // fails on second iteration
T t;
bool b = is(typeof(cast(TU*) &t = null)); // comment to hide a bug
}
}
---
Output:
---
T: shared(void*)
TU: shared(void)*
T: shared(const(void*))
TU: shared(void)*
main.d(16): Error: static assert (is(shared(const(void)) == shared(void))) is
false
---
Second `TU` should be `shared(const(void))*`.
As always, such (unexpected) template bugs are hard to figure out.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list