public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE.
@ 2014-05-06 19:09 svalorzen at gmail dot com
  2014-05-07 16:33 ` [Bug c++/61083] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: svalorzen at gmail dot com @ 2014-05-06 19:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61083

            Bug ID: 61083
           Summary: [C++11] Ambiguous member pointer results in failure,
                    even if used in SFINAE.
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: svalorzen at gmail dot com

Created attachment 32746
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32746&action=edit
The -saved-temps output file.

The following code fails to compile, even though it should succeed. Here is the
output of

g++ -v -std=c++11 main.cpp -save-temps

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.8.1-10ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --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-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-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 --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 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++11
-fpch-preprocess -fstack-protector -Wformat -Wformat-security -o main.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.8
 /usr/include/x86_64-linux-gnu/c++/4.8
 /usr/include/c++/4.8/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus -fpreprocessed main.ii -quiet
-dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -std=c++11
-version -fstack-protector -Wformat -Wformat-security -o main.s
GNU C++ (Ubuntu/Linaro 4.8.1-10ubuntu9) version 4.8.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.8.1-10ubuntu9) version 4.8.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d4f6b5538c661bdd4dde0c4673c032a4
main.cpp: In substitution of ‘template<class Z> static decltype
((is_foo<T>::helper<void (Z::*)()const, (& Z:: foo)>(), std::true_type()))
is_foo<T>::test(Z) [with Z = Z; T = A1] [with Z = A1]’:
main.cpp:19:50:   required from ‘struct is_foo<A1>’
main.cpp:31:28:   required from here
main.cpp:10:55: error: ‘&A::foo’ is not a valid template argument for type
‘void (A1::*)()const’ because it is of type ‘void (A::*)()const’
                 helper<void (Z::*)() const,                       &Z::foo>(),
                                                       ^
main.cpp:10:55: note: standard conversions are not allowed in this context


The code compiles correctly with clang++ (3.4). I'm pasting also the code to
show better what triggers the failure:

#include <iostream>

template <typename T>
struct is_foo {
    private:
        template<typename U, U> struct helper{};

        template <typename Z> static auto test(Z z) -> decltype(

                helper<void (Z::*)() const,                       &Z::foo>(),
                // All other requirements follow..

                std::true_type()
                );

        template <typename> static auto test(...) -> std::false_type;

    public:
        enum { value =
std::is_same<decltype(test<T>(std::declval<T>())),std::true_type>::value };
};

struct A { 
    int foo(); // !!!!!: Failure disappears if this line is removed.
    void foo() const; 
};

struct A1 : public A {};

int main() {
    std::cout << is_foo<A>::value       << '\n';    
    std::cout << is_foo<A1>::value      << '\n';   

    return 0;
}
>From gcc-bugs-return-450716-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 06 19:21:21 2014
Return-Path: <gcc-bugs-return-450716-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27621 invoked by alias); 6 May 2014 19:21:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26925 invoked by uid 48); 6 May 2014 19:21:14 -0000
From: "ro at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/61084] New: wide-int merge broke Solaris/SPARC bootstrap
Date: Tue, 06 May 2014 19:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ro at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc cf_gcchost cf_gcctarget cf_gccbuild
Message-ID: <bug-61084-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg00408.txt.bz2
Content-length: 3638

http://gcc.gnu.org/bugzilla/show_bug.cgi?ida084

            Bug ID: 61084
           Summary: wide-int merge broke Solaris/SPARC bootstrap
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: ebotcazou at gcc dot gnu.org, mrs at gcc dot gnu.org,
                    rsandifo at gcc dot gnu.org
              Host: sparc-sun-solaris2.*
            Target: sparc-sun-solaris2.*
             Build: sparc-sun-solaris2.*

Immediately after the wide-int merge, Solaris/SPARC bootstrap is broken
compiling the stage1 libgcc:

$ /var/gcc/regression/trunk/11-gcc/build/./gcc/xgcc
-B/var/gcc/regression/trunk/11-gcc/build/./gcc/
-B/vol/gcc/sparc-sun-solaris2.11/bin/ -B/vol/gcc/sparc-sun-solaris2.11/lib/
-isystem /vol/gcc/sparc-sun-solaris2.11/include -isystem
/vol/gcc/sparc-sun-solaris2.11/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC    -W
-Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem
./include   -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector
-fPIC -I. -I. -I../.././gcc -I/vol/gcc/src/hg/trunk/local/libgcc
-I/vol/gcc/src/hg/trunk/local/libgcc/.
-I/vol/gcc/src/hg/trunk/local/libgcc/../gcc
-I/vol/gcc/src/hg/trunk/local/libgcc/../include  -DHAVE_CC_TLS  -o _floatdisf.o
-MT _floatdisf.o -MD -MP -MF _floatdisf.dep -DL_floatdisf -c
/vol/gcc/src/hg/trunk/local/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
/vol/gcc/src/hg/trunk/local/libgcc/libgcc2.c: In function '__floatdisf':
/vol/gcc/src/hg/trunk/local/libgcc/libgcc2.c:1674:1: internal compiler error:
in decompose, at rtl.h:1442
 }
 ^
0xae5323 simplify_const_binary_operation(rtx_code, machine_mode, rtx_def*,
rtx_def*)
        /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:3772
0xad976b simplify_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*)
        /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:1958
0xaee5e7 simplify_rtx(rtx_def const*)
        /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:5769
0x592557 cselib_expand_value_rtx_1
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:1830
0x59165f expand_loc
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:1458
0x591b2b cselib_expand_value_rtx_1
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:1621
0x591857 cselib_expand_value_rtx(rtx_def*, bitmap_head*, int)
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:1518
0xede93f reverse_op
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:5816
0xedfff3 add_stores
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:6100
0xa7af2f note_stores(rtx_def const*, void (*)(rtx_def*, rtx_def const*, void*),
void*)
        /vol/gcc/src/hg/trunk/local/gcc/rtlanal.c:1563
0xa7afa3 note_stores(rtx_def const*, void (*)(rtx_def*, rtx_def const*, void*),
void*)
        /vol/gcc/src/hg/trunk/local/gcc/rtlanal.c:1568
0xee2fd3 add_with_sets
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:6540
0x595077 cselib_record_sets
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:2561
0x5958eb cselib_process_insn(rtx_def*)
        /vol/gcc/src/hg/trunk/local/gcc/cselib.c:2673
0xef263f vt_initialize
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:10110
0xef322f variable_tracking_main_1
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:10304
0xef342f variable_tracking_main()
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:10357
0xef350b execute
        /vol/gcc/src/hg/trunk/local/gcc/var-tracking.c:10395

  Rainer


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

* [Bug c++/61083] [C++11] Ambiguous member pointer results in failure, even if used in SFINAE.
  2014-05-06 19:09 [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE svalorzen at gmail dot com
@ 2014-05-07 16:33 ` paolo.carlini at oracle dot com
  2014-05-07 19:32 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-07 16:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61083

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-05-07
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/61083] [C++11] Ambiguous member pointer results in failure, even if used in SFINAE.
  2014-05-06 19:09 [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE svalorzen at gmail dot com
  2014-05-07 16:33 ` [Bug c++/61083] " paolo.carlini at oracle dot com
@ 2014-05-07 19:32 ` paolo at gcc dot gnu.org
  2014-05-07 19:49 ` paolo at gcc dot gnu.org
  2014-05-07 19:50 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-07 19:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61083

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed May  7 19:31:24 2014
New Revision: 210184

URL: http://gcc.gnu.org/viewcvs?rev=210184&root=gcc&view=rev
Log:
/cp
2014-05-07  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/61083
    * pt.c (convert_nontype_argument): Protect all the error calls
    with complain & tf_error.

/testsuite
2014-05-07  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/61083
    * g++.dg/cpp0x/sfinae50.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae50.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/61083] [C++11] Ambiguous member pointer results in failure, even if used in SFINAE.
  2014-05-06 19:09 [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE svalorzen at gmail dot com
  2014-05-07 16:33 ` [Bug c++/61083] " paolo.carlini at oracle dot com
  2014-05-07 19:32 ` paolo at gcc dot gnu.org
@ 2014-05-07 19:49 ` paolo at gcc dot gnu.org
  2014-05-07 19:50 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-07 19:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61083

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed May  7 19:48:53 2014
New Revision: 210186

URL: http://gcc.gnu.org/viewcvs?rev=210186&root=gcc&view=rev
Log:
/cp
2014-05-07  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/61083
    * pt.c (convert_nontype_argument): Protect all the error calls
    with complain & tf_error.

/testsuite
2014-05-07  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/61083
    * g++.dg/cpp0x/sfinae50.C: New.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/sfinae50.C
Modified:
    branches/gcc-4_9-branch/gcc/cp/ChangeLog
    branches/gcc-4_9-branch/gcc/cp/pt.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/61083] [C++11] Ambiguous member pointer results in failure, even if used in SFINAE.
  2014-05-06 19:09 [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE svalorzen at gmail dot com
                   ` (2 preceding siblings ...)
  2014-05-07 19:49 ` paolo at gcc dot gnu.org
@ 2014-05-07 19:50 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-07 19:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61083

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |4.9.1

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed mainline and 4.9.1.


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

end of thread, other threads:[~2014-05-07 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 19:09 [Bug c++/61083] New: [C++11] Ambiguous member pointer results in failure, even if used in SFINAE svalorzen at gmail dot com
2014-05-07 16:33 ` [Bug c++/61083] " paolo.carlini at oracle dot com
2014-05-07 19:32 ` paolo at gcc dot gnu.org
2014-05-07 19:49 ` paolo at gcc dot gnu.org
2014-05-07 19:50 ` paolo.carlini at oracle dot com

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).