www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4329] New: Do not show errors that refer to __error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329

           Summary: Do not show errors that refer to __error
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nfxjfg gmail.com


--- Comment #0 from nfxjfg gmail.com 2010-06-16 08:02:25 PDT ---
dmd should not output error messages like these:

Error: function expected before (), not __error of type TOK149

I have never seen an error message that refers to __error, and that I wanted to
see. They don't add any additional value, and are only (by definition?) caused
by preceding, actual errors. They are only noise and don't add any additional
value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 16 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-06-16 08:50:34 PDT ---
(In reply to comment #0)
 dmd should not output error messages like these:
 
 Error: function expected before (), not __error of type TOK149
 
 I have never seen an error message that refers to __error, and that I wanted to
 see. They don't add any additional value, and are only (by definition?) caused
 by preceding, actual errors. They are only noise and don't add any additional
 value.
__error is a new improvement to the compiler to supress spurious error messages. (in previous releases, it would have been 'int'). You should never see them. Please post any test cases which produce them. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #2 from nfxjfg gmail.com 2010-06-17 02:58:53 PDT ---
Don, it seems to happen all the time. Normally I fix my compilation error right
away, so I don't have a test case ready. See bug 4335 for one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


Leandro Lucarella <llucax gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax gmail.com


--- Comment #3 from Leandro Lucarella <llucax gmail.com> 2010-06-17 06:40:46
PDT ---
Copied from bug 4335 for convenience:

---
import std.stdio;
void main() {
    writeln("bug");
}
---

t.d(3): Error: 'writeln' is not defined, perhaps you need to import std.stdio;
?
t.d(3): Error: function expected before (), not __error of type _error_

(the first wrong error message is what bug 4335 is about)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #4 from Leandro Lucarella <llucax gmail.com> 2010-06-17 06:41:48
PDT ---
BTW, note that this testcase is, unfortunately, D1 only.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #5 from nfxjfg gmail.com 2010-06-17 07:15:10 PDT ---
It's possible that this is D1-only, I noticed the thing above only when working
with D1 code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #6 from Don <clugdbug yahoo.com.au> 2010-06-17 12:38:17 PDT ---
Come on, fellas, you can do better than that. Here's 3 examples, and the last
one produces a segfault. 

void bug4329()
{
   with(great!().trepidation) return;               
   try{
        throw CautionToTheWind;
    } catch(LifeThreatening illness){}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #7 from Don <clugdbug yahoo.com.au> 2010-06-18 01:28:49 PDT ---
And here are another seven cases I found.

TEST CASE B:
--------------
void bug4329b()
{
   create!().havoc!();
   delete something;
    mixin(chaos);
}
bug.d(25): Error: template instance template 'create' is not defined
bug.d(25): Error: undefined identifier create!().havoc
bug.d(25): Error: __error isn't a template
bug.d(26): Error: undefined identifier something
bug.d(26): Error: cannot delete type _error_
bug.d(27): Error: undefined identifier chaos
bug.d(27): Error: argument to mixin must be a string, not (__error)
bug.d(27): Error: argument to mixin must be a string, not (__error)

TEST CASE C:
--------------
void bug4329c()
{
    delete and!(crash);
}
bug.d(33): Error: identifier 'crash' is not defined
bug.d(33): Error: and!(_error_) is not an lvalue
bug.d(33): Error: cannot delete type void

TEST CASE D:
--------------
void bug4329d() {
    make!(mess);   
    switch(2) {
        case 3:.. case 6.7:
        case closed:
    }
}
bug.d(37): Error: identifier 'mess' is not defined
bug.d(37): Error: make!(_error_) has no effect
bug.d(39): Error: cannot implicitly convert expression (6.7) of type double to
i
nt
bug.d(39): Error: first case 3 is greater than last case __error
bug.d(40): Error: undefined identifier closed
bug.d(40): Error: case must be a string or an integral constant, not __error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 18 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #8 from bearophile_hugs eml.cc 2010-07-03 11:03:58 PDT ---
This is a case I have found:

void main() {
    int[] a = cast(int[])array(iota(10));
}


dmd 2.047 prints:
temp.d(2): Error: undefined identifier array
temp.d(2): Error: undefined identifier iota
Error: cannot cast _error_ to int[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #9 from bearophile_hugs eml.cc 2010-07-28 14:13:30 PDT ---
One case, dmd 2.047:

void main() {
    auto x = foo.bar!();
}

test.d(2): Error: undefined identifier foo
test.d(2): Error: __error isn't a template

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 28 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #10 from bearophile_hugs eml.cc 2010-07-31 05:47:27 PDT ---
One case:

void main() {
    enum Foo { E }
    Foo f;
    switch (f) {
        case 1: break;
        default: break;
    }
}


dmd 2.047 prints:
test.d(5): Error: cannot implicitly convert expression (1) of type int to Foo
test.d(5): Error: case must be a string or an integral constant, not __error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #11 from Leandro Lucarella <llucax gmail.com> 2010-08-13 20:07:43
PDT ---
Another testcase:

---
pragma (lib, l);
void main() {}
---

p.d(1): Error: undefined identifier l
p.d(1): Error: pragma lib string expected for library name, not '__error'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #12 from bearophile_hugs eml.cc 2010-09-09 12:49:36 PDT ---
struct Foo {
    int x;
}
void main() {
    Foo(5 ^^ 5); // line 5
}

DMD 2.048 shows:
test.d(5): Error: must import std.math to use ^^ operator
test.d(5): Error: structliteral has no effect in expression (Foo((__error)))

---------------------------

void foo() {}
void main() {
    foreach (x; foo()[0 .. 1]) {}
}

DMD 2.048 shows:
test.d(3): Error: foo() cannot be sliced with []
test.d(3): Error: foreach: _error_ is not an aggregate type

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 09 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #13 from bearophile_hugs eml.cc 2010-09-25 12:36:46 PDT ---
struct Vec(int N) {
    int[N] data;
}
void main() {
    Vec!(1)([1, 2]);
}


DMD 2.049 prints:
test.d(5): Error: cannot implicitly convert expression ([1,2]) of type int[] to
int
test.d(5): Error: structliteral has no effect in expression (Vec((__error)))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 25 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jminer7 gmail.com


--- Comment #14 from Don <clugdbug yahoo.com.au> 2010-11-05 01:22:40 PDT ---
*** Issue 2464 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |braddr puremagic.com
         Resolution|INVALID                     |


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329



--- Comment #15 from Don <clugdbug yahoo.com.au> 2011-02-13 12:46:19 PST ---
Original D1 case is patched here:
https://github.com/donc/dmd/commit/1acd2b64b10c4a985a10750d5ad83a0b7e98332b
Other cases patched for D2:
https://github.com/donc/dmd/commit/3a512771e31de4fb8b4e806154b08766fd97aed1
and for D1:
https://github.com/donc/dmd/commit/327afade5bfe0551176ee17ab6c991139dcb8058

Another test case from bug 5288:
auto bug4329e(int z) {
    if (z) return undefined;
    else return 0;
}
fixed here:
https://github.com/donc/dmd/commit/daff978816461602788f1cb396d9826918b6da21

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4329


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #16 from Don <clugdbug yahoo.com.au> 2011-03-01 17:12:46 PST ---
https://github.com/D-Programming-Language/dmd/commit/3a512771e31de4fb8b4e806154b08766fd97aed1

https://github.com/D-Programming-Language/dmd/commit/daff978816461602788f1cb396d9826918b6da21

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