www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3630] New: bad error location in "has no effect in expression" error

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

           Summary: bad error location in "has no effect in expression"
                    error
           Product: D
           Version: 1.051
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


--- Comment #0 from Vladimir <thecybershadow gmail.com> 2009-12-17 16:09:57 PST
---
Consider:

=== Module a.d ===
enum { A, B, C }

=== Module b.d ===
import a;

// ... thousands of lines of code ...
void foo()
{
    A;
}
// ... thousands of lines of code ...
==================

The error message outputted by the compiler will look like this:
a.d(1): Error: long has no effect in expression (0)

This is more serious considering that starting with 1.049, DMD forbids return
expressions without side effects inside void functions. In my particular case,
this was with the pretty-large DFL library, which required quite a bit of
"divide-et-impera" to find the offending code.

By quickly looking at the compiler code, it looks like this happens because the
expression statement is using the expression directly from the enumeration. The
fix would involve instantiating an enum-reference expression each time an
enumeration member is mentioned, or something like that.

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk smp.if.uj.edu.pl


--- Comment #1 from yebblies <yebblies gmail.com> 2011-06-12 23:19:46 PDT ---
*** Issue 3746 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: -------
Jun 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3630


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from yebblies <yebblies gmail.com> 2011-08-05 12:46:50 EST ---
*** Issue 6233 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: -------
Aug 04 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3630


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies gmail.com
            Version|1.051                       |D1 & D2
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
           Severity|normal                      |major


--- Comment #3 from yebblies <yebblies gmail.com> 2012-02-21 02:48:32 EST ---
https://github.com/D-Programming-Language/dmd/pull/750

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



--- Comment #4 from github-bugzilla puremagic.com 2012-02-20 18:24:49 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/021f361bf01f91e76ccf2bc90483bce857149b54
Merge pull request #750 from yebblies/issue3630

Issue 3630 - bad error location in "has no effect in expression" error

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



--- Comment #5 from github-bugzilla puremagic.com 2012-02-20 19:09:59 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f3ab2da302e894498bd4cfc71cacda844c4f8120
fix Issue 3630 - bad error location in has no effect in expression error

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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


bearophile_hugs eml.cc changed:

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


--- Comment #6 from bearophile_hugs eml.cc 2012-02-20 19:45:51 PST ---
I am seeing this, I don't know why:


dmc -c -Iroot;\dm\include  -o  -cpp  func
            e = p->type->defaultInitLiteral();
                                            ^
func.c(2488) : Error: 1 actual arguments expected for function, had 0
--- errorlevel 1

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



--- Comment #7 from yebblies <yebblies gmail.com> 2012-02-21 14:55:47 EST ---
(In reply to comment #6)
 I am seeing this, I don't know why:
 
 
 dmc -c -Iroot;\dm\include  -o  -cpp  func
             e = p->type->defaultInitLiteral();
                                             ^
 func.c(2488) : Error: 1 actual arguments expected for function, had 0
 --- errorlevel 1
Because Walter merged pull 41 which added that code. I'm glad I took away the default parameter, we just avoided a new missing line number bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 20 2012