https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117290

            Bug ID: 117290
           Summary: error: void value not ignored , pointing to the wrong
                    function
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markgaleck at gmail dot com
  Target Milestone: ---

Created attachment 59433
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59433&action=edit
source SSCCE.c preprocessed with:

version of gcc: 10.1.0

$cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
(...)

command line that triggers the bug:

$gcc -Wall -lc SSCCE.c
SSCCE.c: In function ‘main’:
SSCCE.c:7:6: error: void value not ignored as it ought to be
    7 |  if (access("", F_OK) ?
      |      ^~~~~~

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

Compiling this code snippet:

if (access("", F_OK) ?
        0 ? 0 : exit(0) 
        :
        0)

gcc says:

foobar.c:7:6: error: void value not ignored as it ought to be
    7 |  if (access("", F_OK) ?
      |      ^~~~~~

So it is pointing to "access", but that is not where the problem is.  The
problem is that the void return from "exit" is not ignored.

Reply via email to