D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18303 - Unqual gives weird results for const types
Summary: Unqual gives weird results for const types
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-26 13:58 UTC by Simen Kjaeraas
Modified: 2020-03-21 03:56 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 Simen Kjaeraas 2018-01-26 13:58:04 UTC
When a type T is declared as const, Unqual!T is not T, or perhaps more correctly, T is not T, but const(T). Confusing enough yet? Have a look-see:

import std.traits : Unqual;

const struct T { }

pragma(msg, T); // const(T)
pragma(msg, Unqual!T); // T

static assert(!is(T == Unqual!T));
Comment 1 basile-z 2018-05-18 18:53:31 UTC
I don't see any issue here because

    static assert(is(T == const) && !is(T == Unqual!T));

is perfectly logic.