Jump to page: 1 2
Thread overview
[Issue 19545] __traits(compiles, X) false positive, further uses of X succeed but don't link
Jan 03, 2019
John Colvin
Jan 07, 2019
John Colvin
Jan 07, 2019
John Colvin
Dec 20, 2019
John Colvin
Oct 09, 2020
Walter Bright
Oct 09, 2020
FeepingCreature
Dec 05, 2020
Walter Bright
Dec 03, 2022
John Colvin
Dec 04, 2022
Salih Dincer
Dec 04, 2022
Salih Dincer
Dec 10, 2022
John Colvin
Dec 10, 2022
John Colvin
Dec 17, 2022
Iain Buclaw
Apr 04, 2023
RazvanN
January 03, 2019
https://issues.dlang.org/show_bug.cgi?id=19545

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|phobos                      |dmd

--
January 07, 2019
https://issues.dlang.org/show_bug.cgi?id=19545

--- Comment #1 from John Colvin <john.loughran.colvin@gmail.com> ---
void main()
{
    pragma(msg, __traits(compiles, inputRangeObject(RegexMatch!string.init)));
    inputRangeObject(RegexMatch!string.init);
}

struct RegexMatch(T)
{
}

class InputRangeObject(R)
{
    this(R)
    {
    }

    R front()
    {
    }
}

InputRangeObject!R inputRangeObject(R)(R range)
{
    return new InputRangeObject!R(range);
}

I've tried bisecting to find when in the history this started to go wrong, but it's hard (old dmds don't necessarily build on linux any more due to missing gcc headers).

Here is the output from run.dlang.io, which suggests that there was a problem existing before 2.060, because while there it doesn't mistakenly continue with compilation it still reports `true` when it should say `false`:

Up to      2.060  : Failure with output:
-----
true
onlineapp.d(17): Error: function
onlineapp.InputRangeObject!(RegexMatch!(string)).InputRangeObject.front has no
return statement, but is expected to return a value of type RegexMatch!(string)
-----

           2.061  : Failure with output:
-----
true
onlineapp.o: In function
`_D9onlineapp68__T16inputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16inputRangeObjectFS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZC9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16InputRangeObject':
/sandbox/onlineapp.d:24: undefined reference to
`_D9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16InputRangeObject7__ClassZ'
/sandbox/onlineapp.d:24: undefined reference to
`_D9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16InputRangeObject6__ctorMFS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZC9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16InputRangeObject'
collect2: error: ld returned 1 exit status
--- errorlevel 1
-----

--
January 07, 2019
https://issues.dlang.org/show_bug.cgi?id=19545

--- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> ---
class C()
{
    int foo() { }
}

C!() c()()
{
    return new C!()();
}

static assert(!__traits(compiles, c()));

--
December 20, 2019
https://issues.dlang.org/show_bug.cgi?id=19545

--- Comment #3 from John Colvin <john.loughran.colvin@gmail.com> ---
(In reply to John Colvin from comment #2)
> class C()
> {
>     int foo() { }
> }
> 
> C!() c()()
> {
>     return new C!()();
> }
> 
> static assert(!__traits(compiles, c()));

not sure what this was about, maybe I pressed enter too early back then...

The original bug is still there.

--
October 09, 2020
https://issues.dlang.org/show_bug.cgi?id=19545

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry, wrong-code
                 CC|                            |bugzilla@digitalmars.com

--
October 09, 2020
https://issues.dlang.org/show_bug.cgi?id=19545

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line@yahoo.de

--- Comment #4 from FeepingCreature <default_357-line@yahoo.de> ---
Probably same bug as https://issues.dlang.org/show_bug.cgi?id=19091 ?

--
December 05, 2020
https://issues.dlang.org/show_bug.cgi?id=19545

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=19091

--
December 03, 2022
https://issues.dlang.org/show_bug.cgi?id=19545

--- Comment #5 from John Colvin <john.loughran.colvin@gmail.com> ---
(In reply to John Colvin from comment #1)
> void main()
> {
>     pragma(msg, __traits(compiles,
> inputRangeObject(RegexMatch!string.init)));
>     inputRangeObject(RegexMatch!string.init);
> }
> 
> struct RegexMatch(T)
> {
> }
> 
> class InputRangeObject(R)
> {
>     this(R)
>     {
>     }
> 
>     R front()
>     {
>     }
> }
> 
> InputRangeObject!R inputRangeObject(R)(R range)
> {
>     return new InputRangeObject!R(range);
> }
> 
> I've tried bisecting to find when in the history this started to go wrong, but it's hard (old dmds don't necessarily build on linux any more due to missing gcc headers).
> 
> Here is the output from run.dlang.io, which suggests that there was a problem existing before 2.060, because while there it doesn't mistakenly continue with compilation it still reports `true` when it should say `false`:
> 
> Up to      2.060  : Failure with output:
> -----
> true
> onlineapp.d(17): Error: function
> onlineapp.InputRangeObject!(RegexMatch!(string)).InputRangeObject.front has
> no return statement, but is expected to return a value of type
> RegexMatch!(string)
> -----
> 
>            2.061  : Failure with output:
> -----
> true
> onlineapp.o: In function
> `_D9onlineapp68__T16inputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10Regex
> MatchZ16inputRangeObjectFS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZC9onli
> neapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10RegexMatchZ16
> InputRangeObject':
> /sandbox/onlineapp.d:24: undefined reference to
> `_D9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10Regex
> MatchZ16InputRangeObject7__ClassZ'
> /sandbox/onlineapp.d:24: undefined reference to
> `_D9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10Regex
> MatchZ16InputRangeObject6__ctorMFS9onlineapp20__T10RegexMatchTAyaZ10RegexMatc
> hZC9onlineapp68__T16InputRangeObjectTS9onlineapp20__T10RegexMatchTAyaZ10Regex
> MatchZ16InputRangeObject'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
> -----

This is the test case to pay attention to.

--
December 04, 2022
https://issues.dlang.org/show_bug.cgi?id=19545

Salih Dincer <salihdb@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |salihdb@hotmail.com

--- Comment #6 from Salih Dincer <salihdb@hotmail.com> ---
No error, result is true:

void main()
{
  pragma(msg, __traits(compiles, inputRangeObject(RegexMatch!string.init)));
  inputRangeObject(RegexMatch!string.init);
}
//import std.range, std.regex;/*
struct RegexMatch(T){}

class InputRangeObject(R){
    this(R){}
    R front(){ return R.init; }
}

InputRangeObject!R inputRangeObject(R)(R range) {
    return new InputRangeObject!R(range);
}//*/

--
December 04, 2022
https://issues.dlang.org/show_bug.cgi?id=19545

--- Comment #7 from Salih Dincer <salihdb@hotmail.com> ---
No error, result is true:

void main()
{
  pragma(msg, __traits(compiles, inputRangeObject(RegexMatch!string.init)));
  inputRangeObject(RegexMatch!string.init);
}
//import std.range, std.regex;/*
struct RegexMatch(T){}

class InputRangeObject(R){
    this(R){}
    R front(){ return R.init; }
}

InputRangeObject!R inputRangeObject(R)(R range) {
    return new InputRangeObject!R(range);
}//*/

--
« First   ‹ Prev
1 2