[Issue 3567] std.traits: Unqual doesn't handle arrays well

2018-07-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3567

Timoses  changed:

   What|Removed |Added

 CC||timos...@gmail.com

--- Comment #5 from Timoses  ---
The fact the Unqual only "shallowly" unqualifies a type can be pretty annoying
when dealing with templates and inout functions.


struct S
{
int[] vals;   
}

template Temp(T)
{
class Temp
{
T t;

this(T t)
{ this.t = t; }

auto get() inout
{
static if (is(T == S))
{
import std.traits : Unqual;
alias tType = Unqual!(typeof(t.vals));
pragma(msg, tType); // inout(int)[]
return new inout Temp!tType(t.vals); // ERROR: Can't create
class Temp!(inout(int)[])
}
}
}
}

unittest
{
auto t = Temp!S;
t.get();
}

Error: variable `onlineapp.Temp!(inout(int)[]).Temp.t` only parameters or stack
based variables can be inout
Error: template instance `onlineapp.Temp!(inout(int)[])` error instantiating


In this case a complete stripping of qualifiers is required!

Related discussion:
https://forum.dlang.org/post/enwkjtdqivjldqpzz...@forum.dlang.org

--


[Issue 3567] std.traits: Unqual doesn't handle arrays well

2018-06-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3567

Steven Schveighoffer  changed:

   What|Removed |Added

   Keywords||safe
 CC||schvei...@yahoo.com
   Hardware|Other   |All
 OS|Linux   |All
   Severity|normal  |major

--- Comment #4 from Steven Schveighoffer  ---
This is likely going to be disruptive to fix, so many things use Unqual. But
nonetheless, it's an important bug.

--


[Issue 3567] std.traits: Unqual doesn't handle arrays well

2018-06-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3567

FeepingCreature  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||default_357-l...@yahoo.de
 Resolution|INVALID |---

--- Comment #3 from FeepingCreature  ---
This bug needs a second look.

Consider this code:

struct S
{
  int* ipointer;
}

pragma(msg, (Unqual!(const S)).stringof);

As can be seen, Unqual has just deeply stripped const, not shallowly.

Either Unqual must be made to error when passed a const struct with reference,
or Unqual must leave const(int[]) as int[].

The current state is broken.

--


[Issue 3567] std.traits: Unqual doesn't handle arrays well

2015-06-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3567

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|2.036   |D2

--


[Issue 3567] std.traits: Unqual doesn't handle arrays well

2009-12-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3567


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dsim...@yahoo.com
 Resolution||INVALID


--- Comment #1 from David Simcha dsim...@yahoo.com 2009-12-02 12:39:37 PST ---
This behavior is by design.  Unqual is supposed to shallowly strip const, etc,
not deeply strip it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3567] std.traits: Unqual doesn't handle arrays well

2009-12-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3567



--- Comment #2 from Luther Tychonievich la...@virginia.edu 2009-12-02 
12:46:35 PST ---
Then I propose this design decision ought to be made explicit in the
documentation; removes all qualifiers seemed, to me, to imply removing *all*
qualifiers, not just the top level.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---