[Issue 15907] Unjustified "is not visible from module" deprecation warning when using getMember trait

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15907

--- Comment #9 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/101d65993abc868490876883a17b1ba81c04fe19
fix Issue 15907 - unjustified deprecation with getMember

- skip visibility checks for hasMember, getMember, and getOverloads
- inherit scope flags for the new SCOPEflag and noaccesscheck
- keep existing access checks for now

https://github.com/dlang/dmd/commit/6b285369a9b17216244dfdf8f38fbc48ed38dc53
Merge pull request #6111 from MartinNowak/fix15907

fix Issue 15907 - unjustified deprecation with getMember

--


[Issue 16484] regression(2.064) Overloaded empty funcs trigger AssertError: "Called `get' on null Nullable"

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16484

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #2 from ag0ae...@gmail.com ---
Without phobos:


struct Nullable(T)
{
T x;
alias x this;
}

void foo(T)(Nullable!T value) {}
void foo()(int i) { assert(false); /* hit */ }

void main() { foo(Nullable!int()); }


The second overload being selected is surprising, because it involves an
implicit conversion whereas the first overload would be an exact match. I can't
find anything in the spec about how IFTI interacts with overloading.

--


[Issue 16484] regression(2.064) Overloaded empty funcs trigger AssertError: "Called `get' on null Nullable"

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16484

Nick Sabalausky  changed:

   What|Removed |Added

Summary|Overloaded empty funcs  |regression(2.064)
   |trigger AssertError:|Overloaded empty funcs
   |"Called `get' on null   |trigger AssertError:
   |Nullable"   |"Called `get' on null
   ||Nullable"
   Severity|enhancement |regression

--


[Issue 16484] regression(2.064) Overloaded empty funcs trigger AssertError: "Called `get' on null Nullable"

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16484

--- Comment #1 from Nick Sabalausky  ---
Problem appears to have been introduced in 2.064

--


[Issue 16484] New: Overloaded empty funcs trigger AssertError: "Called `get' on null Nullable"

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16484

  Issue ID: 16484
   Summary: Overloaded empty funcs trigger AssertError: "Called
`get' on null Nullable"
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: cbkbbej...@mailinator.com

---
$ cat test.d
import std.typecons;

void foo(T)(Nullable!T value)
{ }

void foo()(int i)
{ }

void main()
{
Nullable!int x;
foo(x);
}

$ dmd -run test.d
core.exception.AssertError@/home/nick/.dvm/compilers/dmd-2.071.1/linux/bin/../../src/phobos/std/typecons.d(2075):
Called `get' on null Nullable!int.
---

WTF?!?!?

Removing the "int" overload makes the error go away.

--


[Issue 16340] case where version(unittest) results in an invalid warning about a dangling else

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16340

Mathias Lang  changed:

   What|Removed |Added

   Keywords||pull
 CC||mathias.l...@sociomantic.co
   ||m
   Assignee|nob...@puremagic.com|mathias.l...@sociomantic.co
   ||m

--- Comment #1 from Mathias Lang  ---
Pull: https://github.com/dlang/dmd/pull/6118

--


[Issue 16483] New: ICE in expression.d from typeof

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16483

  Issue ID: 16483
   Summary: ICE in expression.d from typeof
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: john.loughran.col...@gmail.com

struct S
{
enum a = is(typeof(false.bar!(x => x)));
}

auto bar(alias foo)(bool var)
{
return foo(var);
}


core.exception.AssertError@expression.d(10347): Assertion failure   

4   dmd 0x0001035f36e8 _d_assert + 104  
5   dmd 0x0001033c897a void
ddmd.expression.__assert(int) + 38  
6   dmd 0x00010345dc5c
_ZN7CallExp8semanticEP5Scope + 13308
7   dmd 0x0001034f0781
_ZN24StatementSemanticVisitor5visitEP15ReturnStatement + 1321   
8   dmd 0x0001034dda34
_ZN15ReturnStatement6acceptEP7Visitor + 28  
9   dmd 0x0001034f3fca
ddmd.statement.Statement ddmd.statementsem.semantic(ddmd.statement.Statement,
ddmd.dscope.Scope*) + 66 
10  dmd 0x0001034e6ba5
_ZN24StatementSemanticVisitor5visitEP17CompoundStatement + 237  
11  dmd 0x0001034dc1a9
_ZN17CompoundStatement6acceptEP7Visitor + 25
12  dmd 0x0001034f3fca
ddmd.statement.Statement ddmd.statementsem.semantic(ddmd.statement.Statement,
ddmd.dscope.Scope*) + 66 
13  dmd 0x0001034725de
_ZN15FuncDeclaration9semantic3EP5Scope + 4614   
14  dmd 0x000103475031
_ZN15FuncDeclaration17functionSemantic3Ev + 113 
15  dmd 0x000103474eb2
_ZN15FuncDeclaration16functionSemanticEv + 266  
16  dmd 0x00010344b4d2
_ZN10DsymbolExp7resolveE3LocP5ScopeP7Dsymbolb + 1274
17  dmd 0x00010344f64b
_ZN8ScopeExp8semanticEP5Scope + 1675
18  dmd 0x00010345ad4e
_ZN7CallExp8semanticEP5Scope + 1262 
19  dmd 0x000103443dba
_Z21resolveUFCSPropertiesP5ScopeP10ExpressionS2_ + 746  
20  dmd 0x000103459359
_ZN22DotTemplateInstanceExp8semanticEP5Scope + 49   
21  dmd 0x0001034b2b24
_ZN10TypeTypeof7resolveE3LocP5ScopePP10ExpressionPP4TypePP7Dsymbolb + 196   
22  dmd 0x0001034b2e20
_ZN10TypeTypeof8semanticE3LocP5Scope + 64   
23  dmd 0x0001034a3d81
_ZN4Type11trySemanticE3LocP5Scope + 65  
24  dmd 0x000103454005
_ZN5IsExp8semanticEP5Scope + 181
25  dmd 0x00010348d9fd
_ZN14ExpInitializer9inferTypeEP5Scope + 37  
26  dmd 0x0001033fc31d
_ZN14VarDeclaration8semanticEP5Scope + 333  
27  dmd 0x000103427225
_ZN17StructDeclaration8semanticEP5Scope + 1013  
28  dmd 0x00010341d275
_ZN6Module8semanticEP5Scope + 117   
29  dmd 0x0001034a139f int
ddmd.mars.tryMain(ulong, const(char)**) + 13103 
30  dmd 0x0001033c90e2 _Dmain + 38  
31  dmd 0x00010360425f
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39  
32  dmd 0x000103604193 void
rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) + 35
33  dmd 0x000103604204 void
rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
+ 44  
34  dmd  

[Issue 16482] New: Compiler should error on impossible cross-class type casts

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16482

  Issue ID: 16482
   Summary: Compiler should error on impossible cross-class type
casts
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: andrej.mitrov...@gmail.com

The following compiles but it's known at compile-time to return null:

-
class C { }
class D { }

void main ( )
{
auto d = new D;
auto c = cast(C)d;  // compiler knows it will be null
}
-

It's possible for a class to define opCast, however it's a templated method and
so the compiler would still know if such casts make sense or not:

-
class C
{
T opCast(T)() if (is(T == D))
{
return new T;
}
}

class D { }

void main ( )
{
auto c = new C;
auto d_from_c = cast(D)c;  // ok, might work

auto d = new D;
auto c_from_d = cast(C)d;  // should error
}
-

There is a slight possibility that this affects some generic code (makes it not
compile), but in such a case the code could easily be changed to use `static if
(is(typeof( cast(Target)source ))).

--


[Issue 16481] invalid code accepted leading to linker error

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16481

ag0ae...@gmail.com changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||ag0ae...@gmail.com

--- Comment #2 from ag0ae...@gmail.com ---
Reduced further:


enum e = is(typeof(fun!()));
void fun()() { auto m = MapResult!()(0); }
alias f = fun!();

struct MapResult()
{
this(int) {}
void front() { undefined(); }
}


Looks similar to issue 16239.

When the 0 in `MapResult!()(0)` is removed, the program compiles and links
(with -main). => accepts-invalid

--


[Issue 16481] invalid code accepted leading to linker error

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16481

--- Comment #1 from John Colvin  ---
Reduced version without phobos imports:

void blah()
{
int[] a;
a.map!(x => x.map!to);
}

template to()
{
}

template map(fun...)
{
auto map(Range)(Range r)
{
alias RE = Range;
alias _fun = unaryFun!fun;
assert(!is(typeof(_fun(RE.init;
MapResult!(_fun, Range)(r);
}
}

struct MapResult(alias fun, Range)
{
alias R = Range;
R _input;

this(R)
{
}

@property front()
{
fun(_input);
}

}

template unaryFun(alias fun)
{
alias unaryFun = fun;
}


Undefined symbols for architecture x86_64:
 
"_D3mod26__T9MapResultS73mod2toTAiZ9MapResult6__ctorMFNaNbNcNiNfAiZS3mod26__T9MapResultS73mod2toTAiZ9MapResult",
referenced from:
  _D3mod17__T3mapS73mod2toZ11__T3mapTAiZ3mapFNaNbNiNfAiZv in mod.o


If you comment out the assert then you get this error instead:

mod.d(34): Error: template mod.to cannot deduce function from argument types
!()(int[]), candidates are:
mod.d(8):mod.to()
mod.d(19): Error: template instance mod.MapResult!(to, int[]) error
instantiating
mod.d(5):instantiated from here: map!(int[])
mod.d(34):instantiated from here: __lambda1!(int[])
mod.d(19):instantiated from here: MapResult!(__lambda1, int[])
mod.d(5):instantiated from here: map!(int[])

which is what I expect and looks ok.

--


[Issue 16481] invalid code accepted leading to linker error

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16481

John Colvin  changed:

   What|Removed |Added

Summary|invalid code accepted   |invalid code accepted
   |leading to  |leading to linker error

--


[Issue 16481] New: invalid code accepted leading to

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16481

  Issue ID: 16481
   Summary: invalid code accepted leading to
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: john.loughran.col...@gmail.com

% cat mod.d
void blah()
{
import std.algorithm;
import std.conv;
int[][] a;
a.map!(x => x.map!to);
}
% dmd mod.d
Undefined symbols for architecture x86_64:
 
"_D3std9algorithm9iteration32__T9MapResultS123std4conv2toTAiZ9MapResult6__ctorMFNaNbNcNiNfAiZS3std9algorithm9iteration32__T9MapResultS123std4conv2toTAiZ9MapResult",
referenced from:
 
_D3std9algorithm9iteration23__T3mapS123std4conv2toZ11__T3mapTAiZ3mapFNaNbNiNfAiZS3std9algorithm9iteration32__T9MapResultS123std4conv2toTAiZ9MapResult
in mod.o
  "_main", referenced from:
 implicit entry/start for main executable
 (maybe you meant: __d_main_args,
_D4core6thread6Thread7sm_mainC4core6thread6Thread )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1


That code shouldn't compile (because of using std.conv.to without a target
type), so it should never hit the linker at all.

--


[Issue 16474] CTFE pow

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16474

--- Comment #2 from Manu  ---
Sure, or reals, whatever precision the compiler does floating point constant
folding would be fine.

--


[Issue 16480] New: Local selective imports hide member functions

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16480

  Issue ID: 16480
   Summary: Local selective imports hide member functions
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: john.loughran.col...@gmail.com

struct S0
{
bool empty() { return false; }
}

struct S1
{
import std.range : empty;
bool empty() { return false; }
}

pragma(msg, typeof(S0.empty)); // bool()
pragma(msg, typeof(S1.empty)); // void

--


[Issue 16479] Wrong C++ mangling for template

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

--- Comment #2 from Thomas Brix Larsen  ---
DMD64 D Compiler v2.071.1

--


[Issue 16479] Wrong C++ mangling for template

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

--- Comment #1 from Thomas Brix Larsen  ---
gcc version 6.2.1 20160830 (GCC)

--


[Issue 16479] Wrong C++ mangling for template

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

Thomas Brix Larsen  changed:

   What|Removed |Added

   Keywords||C++

--


[Issue 16479] New: Wrong C++ mangling for template

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

  Issue ID: 16479
   Summary: Wrong C++ mangling for template
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: b...@brix-verden.dk

testcase_cpp.cpp:
class StructReader
{
public:
template 
T getDataField(unsigned int offset) const
{
return 0;
}
};

void initializeTemplates()
{
StructReader reader;
reader.getDataField(0);
}


testcase.d:
extern(C++) class StructReader
{
public:
byte getDataField(T)(uint offset) const;
}

void main()
{
new StructReader().getDataField!byte(0);
}

g++ -c testcase_cpp.cpp
dmd testcase.d testcase_cpp.o

testcase.o: In function `_Dmain':
testcase.d:(.text._Dmain+0x20): undefined reference to
`StructReader::getDataField::getDataField(unsigned int) const'
collect2: error: ld returned 1 exit status
--- errorlevel 1


D mangles as: _ZNK12StructReader12getDataFieldIaE12getDataFieldEj
Expected C++ symbol: _ZNK12StructReader12getDataFieldIaEET_j

--


[Issue 16451] std.conv.parse without auto-decoding

2016-09-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16451

Jack Stouffer  changed:

   What|Removed |Added

   Keywords||performance
 OS|Linux   |All

--- Comment #2 from Jack Stouffer  ---
https://github.com/dlang/phobos/pull/4674

--