This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69712] New: Storing and reusing a method pointer as compile time value


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

            Bug ID: 69712
           Summary: Storing and reusing a method pointer as compile time
                    value
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: realloc at outlook dot de
  Target Milestone: ---

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

Storing a method pointer as compile-time value and reusing it as non-type
parameter fails.

version: g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
os: Ubuntu 15.10
system: Kernel 4.3.0-040300rc6-generic x86_64 GNU/Linux

result of compilation attempt:
g++ --std=c++14 testcase.cpp -o test
-----------------------------------------
testcase.cpp: In function âint main()â:
testcase.cpp:52:48: error: no matching function for call to âcallMethod(A&)â
  callMethod<decltype(ptr::value), ptr::value>(a);
                                                ^
testcase.cpp:33:16: note: candidate: template<class T, typename method_ptr<
<template-parameter-1-1> >::type fun, class Class, class ... Args>
decltype(auto) callMethod(Class&, Args&& ...)
 decltype(auto) callMethod(Class & obj, Args && ... args)
                ^
testcase.cpp:33:16: note:   template argument deduction/substitution failed:
testcase.cpp:52:48: error: âValue<void (A::*)(), &A::sayHi>::valueâ is not a
valid template argument for type âmethod_ptr<void (A::* const)()>::type {aka
void (A::* const)()}â
  callMethod<decltype(ptr::value), ptr::value>(a);
                                                ^
testcase.cpp:52:48: error: it must be a pointer-to-member of the form â&X::Yâ
testcase.cpp:52:48: error: could not convert template argument âValue<void
(A::*)(), &A::sayHi>::valueâ to âmethod_ptr<void (A::* const)()>::type {aka
void (A::* const)()}â

More detailed:
g++ --std=c++14 -v -save-temps testcase.cpp | head
---------------------------------------------------
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.2.1-22ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) 
COLLECT_GCC_OPTIONS='-std=c++14' '-v' '-save-temps' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE testcase.cpp -mtune=generic -march=x86-64
-std=c++14 -fpch-preprocess -fstack-protector-strong -Wformat -Wformat-security
-o testcase.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-std=c++14' '-v' '-save-temps' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -fpreprocessed testcase.ii -quiet
-dumpbase testcase.cpp -mtune=generic -march=x86-64 -auxbase testcase
-std=c++14 -version -fstack-protector-strong -Wformat -Wformat-security -o
testcase.s
GNU C++14 (Ubuntu 5.2.1-22ubuntu2) version 5.2.1 20151010 (x86_64-linux-gnu)
        compiled by GNU C version 5.2.1 20151010, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (Ubuntu 5.2.1-22ubuntu2) version 5.2.1 20151010 (x86_64-linux-gnu)
        compiled by GNU C version 5.2.1 20151010, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5ed623d6fe11f4bcc1afee70f77e33b0
testcase.cpp: In function âint main()â:
testcase.cpp:52:48: error: no matching function for call to âcallMethod(A&)â
  callMethod<decltype(ptr::value), ptr::value>(a);
                                                ^
testcase.cpp:33:16: note: candidate: template<class T, typename method_ptr<
<template-parameter-1-1> >::type fun, class Class, class ... Args>
decltype(auto) callMethod(Class&, Args&& ...)
 decltype(auto) callMethod(Class & obj, Args && ... args)
                ^
testcase.cpp:33:16: note:   template argument deduction/substitution failed:
testcase.cpp:52:48: error: âValue<void (A::*)(), &A::sayHi>::valueâ is not a
valid template argument for type âmethod_ptr<void (A::* const)()>::type {aka
void (A::* const)()}â
  callMethod<decltype(ptr::value), ptr::value>(a);
                                                ^
testcase.cpp:52:48: error: it must be a pointer-to-member of the form â&X::Yâ
testcase.cpp:52:48: error: could not convert template argument âValue<void
(A::*)(), &A::sayHi>::valueâ to âmethod_ptr<void (A::* const)()>::type {aka
void (A::* const)()}â

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]