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



---
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



*** 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



*** 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



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




Commit pushed to master at https://github.com/D-Programming-Language/dmd

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


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




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



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





 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