[Issue 23855] New: traits getOverloads returns overload when one of the symbols is a templatized function

2023-04-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23855

  Issue ID: 23855
   Summary: traits getOverloads returns overload when one of the
symbols is a templatized function
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: default_357-l...@yahoo.de

That's right, it's the revenge of #16206 !

```
void test()() { }
void test(int) { }

void main() {
alias thisModule = __traits(parent, main);
alias overloads = __traits(getOverloads, thisModule, "test");
pragma(msg, overloads.length); // returns 1
static foreach (member; overloads) {
alias udas = __traits(getAttributes, member);
}
}
```

Leads to

```
Deprecation: `__traits(getAttributes)` may only be used for individual
functions, not overload sets such as: `test`
   the result of `__traits(getOverloads)` may be used to select the desired
function to extract attributes from
```

Ie. despite two symbols existing, __traits(getOverloads) returns the combined
overload set. And for once, it's independent of order too.

--


[Issue 23617] New: traits(child) compile error need this for something that doesn't need this

2023-01-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23617

  Issue ID: 23617
   Summary: traits(child) compile error need this for something
that doesn't need this
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: destructiona...@gmail.com

This code WORKS:

```
struct S {
void foo() {}
}

struct Wrapper {
  size_t currentIndex;
  S[] arrayOfS;
  auto opDispatch(string name, T ...)(T t) {
assert(currentIndex < arrayOfS.length);
alias member = __traits(getMember, S, name);
return __traits(child, arrayOfS[this.currentIndex], member)(t);
  }
}


void main() {
Wrapper w;
w.opDispatch!"foo"();
}
```

But change the alias to inline:

```
struct S {
void foo() {}
}

struct Wrapper {
  size_t currentIndex;
  S[] arrayOfS;
  auto opDispatch(string name, T ...)(T t) {
assert(currentIndex < arrayOfS.length);
// no more separate alias
return __traits(child, arrayOfS[this.currentIndex], __traits(getMember, S,
name))(t);
  }
}

void main() {
Wrapper w;
w.opDispatch!"foo"();
}
```

And get:

wtflol.d(10): Error: symbol expected as second argument of __traits `child`
instead of `this.foo`
wtflol.d(16): Error: template instance `wtflol.Wrapper.opDispatch!"foo"` error
instantiating



OR, change the `this.currentIndex` to just `currentIndex` in either example and
get:

wtflol.d(10): Error: need `this` for `currentIndex` of type `ulong`


So both arguments are attaching things incorrectly.

--


[Issue 22011] New: traits(getMember, Anything, "this") does not bypass visibility

2021-06-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22011

  Issue ID: 22011
   Summary: traits(getMember, Anything, "this") does not bypass
visibility
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: destructiona...@gmail.com

Consider the following:

---
module bugtrait;
class A {
private this() {}
private void foo() {}
}

---

module bugtrait2;
import bugtrait;
void main() {
pragma(msg, __traits(getVisibility, __traits(getMember, A, "foo")));
pragma(msg, __traits(getVisibility, __traits(getMember, A, "this")));
}

---

private
Error: no property `this` for type `bugtrait.A`


The "foo" works fine, it bypasses private when getting the member, allowing me
to inspect its visibility, deprecation status, etc.

But then for "this", it fails, even though traits(allMembers) returns it,
causing an annoying special case.

--


[Issue 20537] New: traits isPackage/isModule and is(package/module) fail on single level package.d import

2020-01-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20537

  Issue ID: 20537
   Summary: traits isPackage/isModule and is(package/module) fail
on single level package.d import
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: boris...@gmail.com

Steps:

mkdir p
touch p/package.d

test.d

import p;

static assert(is(p == package));   // <- fails
static assert(__traits(isPackage, p)); // <- fails
static assert(is(p == module));
static assert(__traits(isModule, p));


dmd testp.d


It should be true in both cases.

--


[Issue 17694] New: traits compiles fails for property of property

2017-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17694

  Issue ID: 17694
   Summary: traits compiles fails for property of property
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: an...@s-e-a-p.de

While the first assertion works, the second assertion fails.
I expect it should work, as the statement "typeof(TButton.Margins.Left) l;"
works fine

class TButton
{
@property TBounds Margins() { return null; }
}

class TBounds
{
@property float Left() { return 0.0; }
}

void main()
{
  mixin(`static assert(__traits(compiles, TButton.Margins));`); // OK
  mixin(`static assert(__traits(compiles, TButton.Margins.Left));`); // FAILS
}

--


[Issue 17373] New: traits getOverloads + multiple interface inheritance only see one of the interfaces' overloads

2017-05-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17373

  Issue ID: 17373
   Summary: traits getOverloads + multiple interface inheritance
only see one of the interfaces' overloads
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: mathias.l...@sociomantic.com

Tested with 2.074 / master as of today:

```
interface Foo { void visit (int); }
interface Bar { void visit (double); }
interface FooBar : Foo, Bar {}

pragma(msg, __traits(getOverloads, FooBar, "visit").length);
```

Outputs `1LU`, which is incorrect as both will be part of the overload set.
This breaks reflection code which tries to auto-instantiate interfaces (like
Blackhole / whitehole).

--


[Issue 16206] New: traits getOverloads fails when one of the overload is a templatized function

2016-06-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16206

  Issue ID: 16206
   Summary: traits getOverloads fails when one of the overload is
a templatized function
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

And the declaration order matters:

struct Foo
{
void foo(A,Z)(A a, Z z){}
void foo(float v){}
}

struct Bar
{
void bar(float v){}
void bar(A,Z)(A a, Z z){}
}

void main()
{
static assert(__traits(getOverloads, Bar, "bar").length > 0); // OK
static assert(__traits(getOverloads, Foo, "foo").length > 0); // FAILS
}

making introspection imprevisible.

--


[Issue 13372] New: traits parent shows template function as its own parent

2014-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13372

  Issue ID: 13372
   Summary: traits parent shows template function as its own
parent
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: ellery-newco...@utulsa.edu

Passing an instantiated eponymous function template to __traits(parent,) yields
a symbol that points to the function passed in. In G in the following code, I'm
seeing this behavior:

  f   __traits(parent, f)
--  --
a  tok
b!int.c__T1bTiZ
t!int  t


code:

import  std.typetuple;

int a(int i) {
return i;
}

template b(T) {
int c(T t) {
return 1;
}
}

int t(T)(T g) {
return 1;
}

template G(alias f) {
static assert(is(typeof(f) == function));
pragma(msg, __traits(identifier, f));
alias Parent = TypeTuple!(__traits(parent, f))[0];
pragma(msg, __traits(identifier, Parent));
static assert(!is(typeof(Parent) == typeof(f)), I'm my own parent?);
}

void main(){
alias y = G!(a);
alias z = G!(t!int); // fails in here
}

--


[Issue 13269] New: Traits hasMember, getMember and compiles get buggy with opDispatch

2014-08-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13269

  Issue ID: 13269
   Summary: Traits hasMember, getMember and compiles get buggy
with opDispatch
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: major
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: czda...@gmail.com

Hey,
this code returns true:

class Test {

void opDispatch( string s, Args ... )( auto ref Args args )
if( false )
{

}

}

pragma( msg, __traits( hasMember, Test, WHATEVEVER_DUDE ) );

Also, stuff like traits compiles and getMember (but that only in compiles)
behave the same.

--


Re: New Traits

2012-05-18 Thread Jacob Carlborg

On 2012-05-18 04:21, John Maschmeyer wrote:


Also, passing lambdas via template alias parameters works. So something
like this should work as well.

void foo(alias dg)() {
writeln(__traits(codeof, dg));
}

void main() {
foo!(x=x+1)();
}


Very nice.

--
/Jacob Carlborg


Re: New Traits

2012-05-17 Thread Jacob Carlborg

On 2012-05-16 23:20, John Maschmeyer wrote:

On Wednesday, 16 May 2012 at 17:08:43 UTC, Philippe Sigaud wrote:

If you give it a module name (qualified with package name), does it
output the entire module code?


Yes



Awesome, now where is that CTFE D compiler :)


--
/Jacob Carlborg


Re: New Traits

2012-05-17 Thread Jacob Carlborg

On 2012-05-16 23:19, John Maschmeyer wrote:


It works for a function literal that has been assigned to a variable.

Function Literal:
int function(int) func = x = x+1;
writeln(__traits(codeof, func));
Outputs:
int function(int) func = delegate pure nothrow @safe int(int x)
{
return x + 1;
}
;


Does it work if the lambda is passed to a function:

void foo (int delegate (int x) dg)
{
wirteln(__traits(codeof, dg);
}

foo(x = x + 1);

--
/Jacob Carlborg


Re: New Traits

2012-05-17 Thread John Maschmeyer

On Thursday, 17 May 2012 at 10:30:26 UTC, Jacob Carlborg wrote:

Does it work if the lambda is passed to a function:

void foo (int delegate (int x) dg)
{
wirteln(__traits(codeof, dg);
}

foo(x = x + 1);


Unforutnately, no.  As written the lambda is a runtime parameter, 
so there is no way the trait can get the actual function code.  
Instead, all that will print is the signature of the delegate.


If that were a template parameter, it would theoretically be 
possible to print the lambda expression, but as currently 
implemented it doesn't.


Re: New Traits

2012-05-17 Thread Justin Whear
On Thu, 17 May 2012 23:20:01 +0200, John Maschmeyer wrote:

 On Thursday, 17 May 2012 at 10:30:26 UTC, Jacob Carlborg wrote:
 Does it work if the lambda is passed to a function:

 void foo (int delegate (int x) dg)
 {
 wirteln(__traits(codeof, dg);
 }

 foo(x = x + 1);
 
 Unforutnately, no.  As written the lambda is a runtime parameter,
 so there is no way the trait can get the actual function code. Instead,
 all that will print is the signature of the delegate.
 
 If that were a template parameter, it would theoretically be possible to
 print the lambda expression, but as currently implemented it doesn't.

An alias parameter to a template would actually be the ideal use-case for 
what I have in mind. Essentially, it would work just like map/reduce/
filter (function passed by alias), but translate the lambda to SQL/XPath/
etc.


Re: New Traits

2012-05-17 Thread John Maschmeyer

On Thursday, 17 May 2012 at 21:39:03 UTC, Justin Whear wrote:
An alias parameter to a template would actually be the ideal 
use-case for
what I have in mind. Essentially, it would work just like 
map/reduce/
filter (function passed by alias), but translate the lambda to 
SQL/XPath/

etc.


I just pushed an update that should support this.

It can now resolve aliases and lambdas properly.  This means 
things like this will work correctly.


module pack.test;
int foo() { return 0;}
int foo(int i) { return i+1; }
void foo(double d) { }

foreach(overload; __traits(getOverloads, pack.test, foo))
   writeln(__traits(codeof, overload);

Also, passing lambdas via template alias parameters works.  So 
something like this should work as well.


void foo(alias dg)() {
   writeln(__traits(codeof, dg));
}

void main() {
   foo!(x=x+1)();
}


Re: New Traits

2012-05-16 Thread Justin Whear
On Tue, 15 May 2012 01:13:27 +0200, John Maschmeyer wrote:

 I implemented some new traits that seemed to have a lot of interest
 recently.
 
 I've implemented parameterNames, isPublic, isPrivate,
 isProtected, isPackge, isExport, and codeof traits.
 
 parameterNames lets you get access to the names of function parameters
 
 isPublic, isPrivate, etc let you query access modifiers
 
 codeof was discussed recently in
 http://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org.
 It gives you access to the source code of functions, classes,
 etc.
 
 I'm pretty new to the dmd code, so could someone take a look at them?
 
 https://github.com/D-Programming-Language/dmd/pull/951
 https://github.com/D-Programming-Language/dmd/pull/952
 https://github.com/D-Programming-Language/dmd/pull/953

Does codeof work with lambda literals? If so, I'm envisioning a LINQ-to-
SQL-esque library.


Re: New Traits

2012-05-16 Thread Philippe Sigaud
On Tue, May 15, 2012 at 11:09 PM, John Maschmeyer jmasc...@gmail.com wrote:
 On Tuesday, 15 May 2012 at 17:18:57 UTC, Philippe Sigaud wrote:

 Can you give us a simple example of what codeof produces? How does it
 deal with functions overloads?

(examples)
 *

Wonderful. I'm already salivating, er I mean I'm quite eager to get my
hands on it.

Jeebus, we will be able to do wonderful things with this. Code
extraction, parsing, AST modif and then code re-creation and mixin.


If you give it a module name (qualified with package name), does it
output the entire module code?


 I'm not sure how well this works with overloads.  If you just use the symbol
 name, it works like other traits and returns the source code for the first
 match.  I tried using the getOverloads trait and some alias magic, but all
 I've been able to do so far is get the prototype for overloads.  I'm
 guessing it has something to do with using an alias instead of the actual
 symbol.  I think we need a better way to reference an overloaded symbol.

Don't sweat it for now. It's a bit more uncommon.

what does this output?

int foo() { return 0;}
int foo(int i) { return i+1; }
void foo(double d) { }

foreach(i,overload; __traits(getOverloads, foo))
writeln(overload.codef);


Re: New Traits

2012-05-16 Thread Jacob Carlborg

On 2012-05-16 19:04, Justin Whear wrote:


Does codeof work with lambda literals? If so, I'm envisioning a LINQ-to-
SQL-esque library.


That would be awesome to do. Actually, if D had operator overloading 
that worked a bit more like it does in C++ that would be sufficient in 
most cases.


--
/Jacob Carlborg


Re: New Traits

2012-05-16 Thread John Maschmeyer

On Wednesday, 16 May 2012 at 17:04:32 UTC, Justin Whear wrote:
Does codeof work with lambda literals? If so, I'm envisioning a 
LINQ-to-

SQL-esque library.


It works for a function literal that has been assigned to a 
variable.


Function Literal:
  int function(int) func = x = x+1;
  writeln(__traits(codeof, func));
Outputs:
  int function(int) func = delegate pure nothrow @safe int(int x)
  {
  return x + 1;
  }
  ;


Re: New Traits

2012-05-16 Thread John Maschmeyer

On Wednesday, 16 May 2012 at 17:08:43 UTC, Philippe Sigaud wrote:
If you give it a module name (qualified with package name), 
does it

output the entire module code?


Yes


what does this output?

int foo() { return 0;}
int foo(int i) { return i+1; }
void foo(double d) { }

foreach(i,overload; __traits(getOverloads, foo))
writeln(overload.codef);


int foo();

int foo(int i);

void foo(double d);


Re: New Traits

2012-05-15 Thread Jacob Carlborg

On 2012-05-15 01:13, John Maschmeyer wrote:

I implemented some new traits that seemed to have a lot of
interest recently.

I've implemented parameterNames, isPublic, isPrivate,
isProtected, isPackge, isExport, and codeof traits.

parameterNames lets you get access to the names of function
parameters

isPublic, isPrivate, etc let you query access modifiers

codeof was discussed recently in
http://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org.
It gives you access to the source code of functions, classes,
etc.

I'm pretty new to the dmd code, so could someone take a look at
them?

https://github.com/D-Programming-Language/dmd/pull/951
https://github.com/D-Programming-Language/dmd/pull/952
https://github.com/D-Programming-Language/dmd/pull/953


Wow, all these are awesome. Nice work.

--
/Jacob Carlborg


Re: New Traits

2012-05-15 Thread Manu
Wow, my hero!
I have needed every single one of these!

One other thing I also need though which might fit in this set, is the
function default arg expressions.
I currently try to parse it out of func.stringof, but the string returned
isn't actually valid code that compiles...


On 15 May 2012 02:13, John Maschmeyer jmasc...@gmail.com wrote:

 I implemented some new traits that seemed to have a lot of
 interest recently.

 I've implemented parameterNames, isPublic, isPrivate,
 isProtected, isPackge, isExport, and codeof traits.

 parameterNames lets you get access to the names of function
 parameters

 isPublic, isPrivate, etc let you query access modifiers

 codeof was discussed recently in
 http://forum.dlang.org/thread/**huyqfcoosgzfneswnrur@forum.**dlang.orghttp://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org
 .
   It gives you access to the source code of functions, classes,
 etc.

 I'm pretty new to the dmd code, so could someone take a look at
 them?

 https://github.com/D-**Programming-Language/dmd/pull/**951https://github.com/D-Programming-Language/dmd/pull/951
 https://github.com/D-**Programming-Language/dmd/pull/**952https://github.com/D-Programming-Language/dmd/pull/952
 https://github.com/D-**Programming-Language/dmd/pull/**953https://github.com/D-Programming-Language/dmd/pull/953



Re: New Traits

2012-05-15 Thread Gor Gyolchanyan
On Tue, May 15, 2012 at 3:13 AM, John Maschmeyer jmasc...@gmail.com wrote:

 I implemented some new traits that seemed to have a lot of
 interest recently.

 I've implemented parameterNames, isPublic, isPrivate,
 isProtected, isPackge, isExport, and codeof traits.

 parameterNames lets you get access to the names of function
 parameters

 isPublic, isPrivate, etc let you query access modifiers

 codeof was discussed recently in
 http://forum.dlang.org/thread/**huyqfcoosgzfneswnrur@forum.**dlang.orghttp://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org
 .
   It gives you access to the source code of functions, classes,
 etc.

 I'm pretty new to the dmd code, so could someone take a look at
 them?

 https://github.com/D-**Programming-Language/dmd/pull/**951https://github.com/D-Programming-Language/dmd/pull/951
 https://github.com/D-**Programming-Language/dmd/pull/**952https://github.com/D-Programming-Language/dmd/pull/952
 https://github.com/D-**Programming-Language/dmd/pull/**953https://github.com/D-Programming-Language/dmd/pull/953


This is exquisitely awesome! Thank you!
The only question that remains is: How about the fact, that
__traits(getMember, Class, PrivateMember) doesn't compile?
With the new __traits(parameterNames, ...) It's not an issue any more...

-- 
Bye,
Gor Gyolchanyan.


Re: New Traits

2012-05-15 Thread Philippe Sigaud
On Tue, May 15, 2012 at 1:13 AM, John Maschmeyer jmasc...@gmail.com wrote:
 I implemented some new traits that seemed to have a lot of
 interest recently.

 I've implemented parameterNames, isPublic, isPrivate,
 isProtected, isPackge, isExport, and codeof traits.

 codeof was discussed recently in
 http://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org.
   It gives you access to the source code of functions, classes,
 etc.

Awesome!

Can you give us a simple example of what codeof produces? How does it
deal with functions overloads?


Re: New Traits

2012-05-15 Thread John Maschmeyer

On Tuesday, 15 May 2012 at 17:18:57 UTC, Philippe Sigaud wrote:
Can you give us a simple example of what codeof produces? How 
does it

deal with functions overloads?


import std.stdio;

void bar() {
   writeln(testing);
}

struct Foo {
 public:
  int x;
  int y;
}

void main() {
   writeln(*);
   writeln(__traits(codeof, bar));
   writeln(*);
   writeln(__traits(codeof, Foo));
   writeln(*);
}

This prints:
*
void bar()
{
writeln(testing);
}

*
struct Foo
{
public
{
int x;
int y;
}
}

*

I'm not sure how well this works with overloads.  If you just use 
the symbol name, it works like other traits and returns the 
source code for the first match.  I tried using the getOverloads 
trait and some alias magic, but all I've been able to do so far 
is get the prototype for overloads.  I'm guessing it has 
something to do with using an alias instead of the actual symbol. 
 I think we need a better way to reference an overloaded symbol.


Re: New Traits

2012-05-15 Thread F i L

On Monday, 14 May 2012 at 23:13:29 UTC, John Maschmeyer wrote:

I implemented some new traits that seemed to have a lot of
interest recently.

I've implemented parameterNames, isPublic, isPrivate,
isProtected, isPackge, isExport, and codeof traits.

parameterNames lets you get access to the names of function
parameters

isPublic, isPrivate, etc let you query access modifiers

codeof was discussed recently in
http://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org.
   It gives you access to the source code of functions, classes,
etc.

I'm pretty new to the dmd code, so could someone take a look at
them?

https://github.com/D-Programming-Language/dmd/pull/951
https://github.com/D-Programming-Language/dmd/pull/952
https://github.com/D-Programming-Language/dmd/pull/953


This is great! Can't wait to use these in action (codeof mostly), 
hopefully it'll make it into 2.030.


:D



Re: New Traits

2012-05-15 Thread Nick Sabalausky
F i L witte2...@gmail.com wrote in message 
news:amhbhvoaaxncbyalo...@forum.dlang.org...

 This is great! Can't wait to use these in action (codeof mostly), 
 hopefully it'll make it into 2.030.


Little too late for that. Maybe for 2.060, though. /smartass




New Traits

2012-05-14 Thread John Maschmeyer

I implemented some new traits that seemed to have a lot of
interest recently.

I've implemented parameterNames, isPublic, isPrivate,
isProtected, isPackge, isExport, and codeof traits.

parameterNames lets you get access to the names of function
parameters

isPublic, isPrivate, etc let you query access modifiers

codeof was discussed recently in
http://forum.dlang.org/thread/huyqfcoosgzfneswn...@forum.dlang.org.
   It gives you access to the source code of functions, classes,
etc.

I'm pretty new to the dmd code, so could someone take a look at
them?

https://github.com/D-Programming-Language/dmd/pull/951
https://github.com/D-Programming-Language/dmd/pull/952
https://github.com/D-Programming-Language/dmd/pull/953


[Issue 7596] New: traits compiles can't detect non-copyable errors

2012-02-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7596

   Summary: traits compiles can't detect non-copyable errors
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-02-26 13:22:14 PST ---
struct S
{
@disable this(this);
}
static assert(!__traits(compiles, (S s) = s));
static assert(!__traits(compiles, function S(S s) { return s; }));



The error is detected too late, i.e. in the glue layer.

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


[Issue 7408] New: traits compiles fails for built-in properties of template instances

2012-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7408

   Summary: traits compiles fails for built-in properties of
template instances
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-01-30 22:37:44 PST ---
template foobar()
{
}

void main()
{
pragma(msg, foobar!().stringof);   // OK
static assert(__traits(compiles, foobar!().stringof)); // FAILS
}



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


[Issue 3903] New: Traits compiles as true for an array sum with wrong syntax

2010-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3903

   Summary: Traits compiles as true for an array sum with wrong
syntax
   Product: D
   Version: 2.041
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-03-08 15:04:06 PST ---
This compiles, but the traits has to return 'false' here:

void main() {
int[2] a = [1, 2];
assert( __traits(compiles, {return a + a;}) );
//auto r = a + a; // error
}

See also bug 3817 .

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


[Issue 3309] New: `Traits` : function parameters name

2009-09-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3309

   Summary: `Traits` : function parameters name
   Product: D
   Version: future
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: jul...@onandon.be


--- Comment #0 from Julien Leclercq jul...@onandon.be 2009-09-10 06:58:50 PDT 
---
Created an attachment (id=448)
traits.c patch

Hello,

I'm trying to add a small __traits keyword to traits.c to get a function
parameter names, as :

void foo(in string name) would return [ name ];
void bar(in string firstname, in string lastname) would return [
firstname, lastname ];

Thanks to Andrei  Walter for the first tips.

Please review the patch,
Thank you,
Julian.

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