public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95143] New: SFINAE failure with static_cast
@ 2020-05-14 20:13 familiebaumanns at gmail dot com
  2020-05-14 20:16 ` [Bug c++/95143] " familiebaumanns at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95143
           Summary: SFINAE failure with static_cast
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: familiebaumanns at gmail dot com
  Target Milestone: ---

Bug 90080 - [8 Regression] SFINAE failure with static_cast
Bug 87748 - [8 Regression] G++-8 treats SFINAE as error

This bug seems to be back in g++-10.1

See the following code: https://godbolt.org/z/yVjQf9

It works in g++-9 and in g++-11 / g++-trunk.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
@ 2020-05-14 20:16 ` familiebaumanns at gmail dot com
  2020-05-14 20:18 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

Bernd Baumanns <familiebaumanns at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://godbolt.org/z/yVjQf
                   |                            |9

--- Comment #1 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
https://godbolt.org/z/FRznAh

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
  2020-05-14 20:16 ` [Bug c++/95143] " familiebaumanns at gmail dot com
@ 2020-05-14 20:18 ` redi at gcc dot gnu.org
  2020-05-14 20:39 ` familiebaumanns at gmail dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-14 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-05-14
             Status|UNCONFIRMED                 |WAITING

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please read https://gcc.gnu.org/bugs (as requested when creating a bug) and
provide the missing information.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
  2020-05-14 20:16 ` [Bug c++/95143] " familiebaumanns at gmail dot com
  2020-05-14 20:18 ` redi at gcc dot gnu.org
@ 2020-05-14 20:39 ` familiebaumanns at gmail dot com
  2020-05-14 20:42 ` familiebaumanns at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
Created attachment 48541
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48541&action=edit
ii file

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-14 20:39 ` familiebaumanns at gmail dot com
@ 2020-05-14 20:42 ` familiebaumanns at gmail dot com
  2020-05-14 20:44 ` familiebaumanns at gmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
Created attachment 48543
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48543&action=edit
g++-10 -v -save-temps -std=c++2a /mnt/j/test.cpp

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-14 20:42 ` familiebaumanns at gmail dot com
@ 2020-05-14 20:44 ` familiebaumanns at gmail dot com
  2020-05-14 20:53 ` familiebaumanns at gmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
Created attachment 48544
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48544&action=edit
source

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (4 preceding siblings ...)
  2020-05-14 20:44 ` familiebaumanns at gmail dot com
@ 2020-05-14 20:53 ` familiebaumanns at gmail dot com
  2020-05-14 20:55 ` familiebaumanns at gmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
simplified source (without include type_traits):
----------------------------
class false_type
{
public:
    static constexpr bool value = false;
};

class true_type{
public:
    static constexpr bool value = true;
};

template<class T>
T&& declval() noexcept;

template<typename T, typename U, typename = U>
struct is_static_castable : false_type
{};
template<typename T, typename U>
struct is_static_castable<T, U, decltype(static_cast<U>(declval<T>()))> :
true_type
{};

class Base
{};

struct A
{};

class B: public Base
{};

int main()
{
    constexpr auto canCast = is_static_castable<A, B>::value;
    static_assert(!canCast);
    constexpr auto canCast2 = is_static_castable<A, A>::value;
    static_assert(canCast2);
    return 0;
}

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (5 preceding siblings ...)
  2020-05-14 20:53 ` familiebaumanns at gmail dot com
@ 2020-05-14 20:55 ` familiebaumanns at gmail dot com
  2020-05-14 21:08 ` familiebaumanns at gmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
I hope you have now all you need.

This bug is only triggered in C++20 mode and with inheritance.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (6 preceding siblings ...)
  2020-05-14 20:55 ` familiebaumanns at gmail dot com
@ 2020-05-14 21:08 ` familiebaumanns at gmail dot com
  2020-05-14 21:10 ` familiebaumanns at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
fails with this version:
g++ (Compiler-Explorer-Build) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiler returned: 0


And this:
g++-10 (Ubuntu 10-20200417-0ubuntu1) 10.0.1 20200417 (experimental) [master
revision a64468a3034:28feadc0609:b835645c7a51b7e99092abe61d677aa491836f95]
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (7 preceding siblings ...)
  2020-05-14 21:08 ` familiebaumanns at gmail dot com
@ 2020-05-14 21:10 ` familiebaumanns at gmail dot com
  2020-05-14 21:47 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: familiebaumanns at gmail dot com @ 2020-05-14 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Bernd Baumanns <familiebaumanns at gmail dot com> ---
fails with this version:
g++-10.1 (GCC) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (8 preceding siblings ...)
  2020-05-14 21:10 ` familiebaumanns at gmail dot com
@ 2020-05-14 21:47 ` redi at gcc dot gnu.org
  2020-05-14 22:04 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-14 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.1.0
           Keywords|                            |needs-bisection,
                   |                            |rejects-valid
             Status|WAITING                     |NEW
      Known to work|                            |10.1.1, 11.0, 9.2.0

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks. Confirmed as a bug in 10.1 but it already seems to be fixed on the
gcc-10 branch after the release. I'll bisect it.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (9 preceding siblings ...)
  2020-05-14 21:47 ` redi at gcc dot gnu.org
@ 2020-05-14 22:04 ` redi at gcc dot gnu.org
  2020-05-15  7:26 ` rguenth at gcc dot gnu.org
  2020-05-18 17:53 ` cvs-commit at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-14 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Possibly fixed as part of PR 94885.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (10 preceding siblings ...)
  2020-05-14 22:04 ` redi at gcc dot gnu.org
@ 2020-05-15  7:26 ` rguenth at gcc dot gnu.org
  2020-05-18 17:53 ` cvs-commit at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-15  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thus fixed.  Adding the testcase might be nice.

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

* [Bug c++/95143] SFINAE failure with static_cast
  2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
                   ` (11 preceding siblings ...)
  2020-05-15  7:26 ` rguenth at gcc dot gnu.org
@ 2020-05-18 17:53 ` cvs-commit at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-18 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:be464161b4ae128681958d94aa460531cf30e0a4

commit r11-459-gbe464161b4ae128681958d94aa460531cf30e0a4
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon May 18 13:50:39 2020 -0400

    c++: Add test for c++/95143

    Already fixed by r10-8124-gceae6a13366d9646e172fc943fe8e221b70f0920.

            PR c++/95143
            * g++.dg/cpp0x/sfinae66.C: New test.

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

end of thread, other threads:[~2020-05-18 17:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 20:13 [Bug c++/95143] New: SFINAE failure with static_cast familiebaumanns at gmail dot com
2020-05-14 20:16 ` [Bug c++/95143] " familiebaumanns at gmail dot com
2020-05-14 20:18 ` redi at gcc dot gnu.org
2020-05-14 20:39 ` familiebaumanns at gmail dot com
2020-05-14 20:42 ` familiebaumanns at gmail dot com
2020-05-14 20:44 ` familiebaumanns at gmail dot com
2020-05-14 20:53 ` familiebaumanns at gmail dot com
2020-05-14 20:55 ` familiebaumanns at gmail dot com
2020-05-14 21:08 ` familiebaumanns at gmail dot com
2020-05-14 21:10 ` familiebaumanns at gmail dot com
2020-05-14 21:47 ` redi at gcc dot gnu.org
2020-05-14 22:04 ` redi at gcc dot gnu.org
2020-05-15  7:26 ` rguenth at gcc dot gnu.org
2020-05-18 17:53 ` cvs-commit 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).