public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108231] New: g++ mistakenly reports ambiguity between equivalent function declarations
@ 2022-12-27  7:30 bruno at clisp dot org
  2022-12-27  7:45 ` [Bug c++/108231] malloc attribute vs extern "C" in a namespace and global and using of one in the namespace in the global one pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2022-12-27  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108231
           Summary: g++ mistakenly reports ambiguity between equivalent
                    function declarations
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

Created attachment 54156
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54156&action=edit
test case

The attached code, i1.cc, contains two equivalent function declarations for the
function 'free'. They are equivalent because they have the same signature and
both have "C" linkage.

In lines 9, 10, 12, 13, referencing the function 'free' works fine.

However, referencing it in line 17, as part of a
__attribute__ ((__malloc__ (free, 1)))
attribute, leads to an error "‘malloc’ attribute argument 1 is ambiguous".

I would expect no error, no warning.

How to reproduce:
$ g++ -S i1.cc
i1.cc:17:67: error: ‘malloc’ attribute argument 1 is ambiguous
   17 | __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (free, 1)));
      |                                                                   ^
i1.cc:17:67: note: use a cast to the expected type to disambiguate

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-27  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27  7:30 [Bug c++/108231] New: g++ mistakenly reports ambiguity between equivalent function declarations bruno at clisp dot org
2022-12-27  7:45 ` [Bug c++/108231] malloc attribute vs extern "C" in a namespace and global and using of one in the namespace in the global one pinskia at gcc dot gnu.org
2022-12-27  8:04 ` [Bug c++/108231] malloc attribute vs extern "C" in a namespace and global and using of one in the namespace in the global one and the builtin free pinskia at gcc dot gnu.org
2022-12-27  8:11 ` [Bug c++/108231] malloc and cleanup attributes " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).