public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65789] New: "cannot convert" calling convention
@ 2015-04-16 21:12 puetzk at puetzk dot org
  2015-04-16 21:13 ` [Bug c++/65789] " puetzk at puetzk dot org
  2021-07-23  1:35 ` [Bug target/65789] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: puetzk at puetzk dot org @ 2015-04-16 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65789
           Summary: "cannot convert" calling convention
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: puetzk at puetzk dot org

Created attachment 35339
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35339&action=edit
example using a member function pointer - poor error message

When the calling convention of a member function pointer does not match the
calling convention of a member function pointer, the compiler reports the error
but the message is unhelpful; it gives the exactly same description for both
the input and output types, failing to mention the difference in calling
convention. Conversions of a non-member (or static member) to an ordinary
function pointer behave as expected, and mention the attribute.

This is demonstrated by the two attached test-case files:
* test-static.cpp (free function pointer) fails using the phrase "invalid
conversion", which correctly identifies the difference
* test-member.cpp (member function pointer) fails using the phrase "cannot
convert", but gives identical descriptions of the input and output types.

g++ -fsyntax-only test-static.cpp
test-static.cpp: In function 'int main()':
test-static.cpp:6:22: error: invalid conversion from 'void
(__attribute__((__stdcall__)) *)()' to 'void (*)()' [-fpermissive]
  void (*f)() = &foo::bar;
                      ^

g++ -fsyntax-only test-member.cpp
test-member.cpp: In function 'int main()':
test-member.cpp:6:27: error: cannot convert 'void (foo::*)()' to 'void
(foo::*)()' in initialization
  void (foo::*f)() = &foo::bar;
                           ^
gcc -v
Using built-in specs.
COLLECT_GCC=C:\projects\mingw32-4.9.2\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/projects/mingw32-4.9.2/bin/../libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure --host=i686-w64-mingw32
--build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
--with-sysroot=/c/mingw492/i686-492-win32-dwarf-rt_v3-rev1/mingw32
--with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared
--enable-static --disable-multilib
--enable-languages=ada,c,c++,fortran,objc,obj-c++,lto
--enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp
--enable-libatomic --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check
--disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug
--enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls
--disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686
--with-tune=generic --with-libiconv --with-system-zlib
--with-gmp=/c/mingw492/prerequisites/i686-w64-mingw32-static
--with-mpfr=/c/mingw492/prerequisites/i686-w64-mingw32-static
--with-mpc=/c/mingw492/prerequisites/i686-w64-mingw32-static
--with-isl=/c/mingw492/prerequisites/i686-w64-mingw32-static
--with-cloog=/c/mingw492/prerequisites/i686-w64-mingw32-static
--enable-cloog-backend=isl --with-pkgversion='i686-win32-dwarf-rev1, Built by
MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64
CFLAGS='-O2 -pipe
-I/c/mingw492/i686-492-win32-dwarf-rt_v3-rev1/mingw32/opt/include
-I/c/mingw492/prerequisites/i686-zlib-static/include
-I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v3-rev1/mingw32/opt/include
-I/c/mingw492/prerequisites/i686-zlib-static/include
-I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe -L/c/mingw492/i686-492-win32-dwarf-rt_v3-rev1/mingw32/opt/lib
-L/c/mingw492/prerequisites/i686-zlib-static/lib
-L/c/mingw492/prerequisites/i686-w64-mingw32-static/lib -Wl
,--large-address-aware'
Thread model: win32
gcc version 4.9.2 (i686-win32-dwarf-rev1, Built by MinGW-W64 project)


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

* [Bug c++/65789] "cannot convert" calling convention
  2015-04-16 21:12 [Bug c++/65789] New: "cannot convert" calling convention puetzk at puetzk dot org
@ 2015-04-16 21:13 ` puetzk at puetzk dot org
  2021-07-23  1:35 ` [Bug target/65789] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: puetzk at puetzk dot org @ 2015-04-16 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Kevin Puetz <puetzk at puetzk dot org> ---
Created attachment 35340
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35340&action=edit
example using a free function pointer - works as expected


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

* [Bug target/65789] "cannot convert" calling convention
  2015-04-16 21:12 [Bug c++/65789] New: "cannot convert" calling convention puetzk at puetzk dot org
  2015-04-16 21:13 ` [Bug c++/65789] " puetzk at puetzk dot org
@ 2021-07-23  1:35 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23  1:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
          Component|c++                         |target

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 29328.

*** This bug has been marked as a duplicate of bug 29328 ***

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

end of thread, other threads:[~2021-07-23  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 21:12 [Bug c++/65789] New: "cannot convert" calling convention puetzk at puetzk dot org
2015-04-16 21:13 ` [Bug c++/65789] " puetzk at puetzk dot org
2021-07-23  1:35 ` [Bug target/65789] " 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).