public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97999] New: pass address of instance of function template to another instance of the same function template with placeholder return type
@ 2020-11-26  4:28 spartan_117 at juno dot com
  2020-11-26  4:39 ` [Bug c++/97999] " spartan_117 at juno dot com
  2021-07-27  7:14 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: spartan_117 at juno dot com @ 2020-11-26  4:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97999
           Summary: pass address of instance of function template to
                    another instance of the same function template with
                    placeholder return type
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: spartan_117 at juno dot com
  Target Milestone: ---

Created attachment 49630
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49630&action=edit
preprocessed file

version:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/10/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-10.2.0/configure
--srcdir=/mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-10.2.0 --prefix=/usr
--exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib
--with-gcc-major-version-only --enable-shared --enable-shared-libgcc
--enable-static --enable-version-specific-runtime-libs --enable-bootstrap
--enable-__cxa_atexit --with-dwarf2 --with-tune=generic
--enable-languages=c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --enable-libquadmath
--enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers
--with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl
--without-libiconv-prefix --without-libintl-prefix --with-system-zlib
--enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
--enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC) 

command line:
g++ -std=c++17 bug.cc

compiler output:
bug.cc: In function 'int main()':
bug.cc:5:20: error: no matching function for call to 'yolo(<unresolved
overloaded function type>)'
    5 |     yolo(&yolo<int>);
      |                    ^
bug.cc:2:13: note: candidate: 'template<class type> auto yolo(type)'
    2 | static auto yolo(type) {}
      |             ^~~~
bug.cc:2:13: note:   template argument deduction/substitution failed:
bug.cc:5:20: note:   couldn't deduce template parameter 'type'
    5 |     yolo(&yolo<int>);
      |                    ^

preprocessed file:
see attached "bug.ii"

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

* [Bug c++/97999] pass address of instance of function template to another instance of the same function template with placeholder return type
  2020-11-26  4:28 [Bug c++/97999] New: pass address of instance of function template to another instance of the same function template with placeholder return type spartan_117 at juno dot com
@ 2020-11-26  4:39 ` spartan_117 at juno dot com
  2021-07-27  7:14 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: spartan_117 at juno dot com @ 2020-11-26  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from spartan_117 at juno dot com ---
Adding a statement before the call that simply takes the address of the inner
function template instance results in successful compilation.  For example:

template <typename type>
static auto yolo(type) {}

auto main(void) -> int {
    &yolo<int>; // this line added
    yolo(&yolo<int>);
}

Also, without this addition, it compiles successfully if yolo()'s return type
is given explicitly (as void).

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

* [Bug c++/97999] pass address of instance of function template to another instance of the same function template with placeholder return type
  2020-11-26  4:28 [Bug c++/97999] New: pass address of instance of function template to another instance of the same function template with placeholder return type spartan_117 at juno dot com
  2020-11-26  4:39 ` [Bug c++/97999] " spartan_117 at juno dot com
@ 2021-07-27  7:14 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 64194 which is fixed for GCC 10.3.

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

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

end of thread, other threads:[~2021-07-27  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  4:28 [Bug c++/97999] New: pass address of instance of function template to another instance of the same function template with placeholder return type spartan_117 at juno dot com
2020-11-26  4:39 ` [Bug c++/97999] " spartan_117 at juno dot com
2021-07-27  7:14 ` 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).