public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code
@ 2020-09-29  8:26 lutztonineubert at gmail dot com
  2020-09-29 10:11 ` [Bug c++/97237] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lutztonineubert at gmail dot com @ 2020-09-29  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97237
           Summary: [10/11 Regression] static_assert does not accept
                    fpermissive code
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lutztonineubert at gmail dot com
  Target Milestone: ---

The following valid code:

  constexpr bool test() {
      auto i = 1 << 132;
      return true;
  }

  static_assert(test());

Build with GCC -fpermissive does compile in GCC 9 but not in 10/11:

> non-constant condition for static assertion

See: https://gcc.godbolt.org/z/r85zvP

But this code is valid in all versions:

  constexpr bool test() {
      auto i = 1 << 132;
      return true;
  }

  constexpr auto t = test();

  static_assert(t);

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
@ 2020-09-29 10:11 ` redi at gcc dot gnu.org
  2020-09-29 10:21 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-09-29 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.2.0, 11.0
   Last reconfirmed|                            |2020-09-29
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jakub at gcc dot gnu.org
      Known to work|                            |9.3.0
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Started to be rejected with r276622 "PR c++/91369 - Implement P0784R7:
constexpr new"

I'm not sure how much we care about accepting this.

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
  2020-09-29 10:11 ` [Bug c++/97237] " redi at gcc dot gnu.org
@ 2020-09-29 10:21 ` jakub at gcc dot gnu.org
  2020-09-29 10:43 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-29 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It surprises me -fpermissive ever accepted such bogosities.
Also using -fpermissive with C++11 and later code is very weird, -fpermissive
is about letting some very old unmaintained code compile, but using that
together with C++11 features doesn't make sense.

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
  2020-09-29 10:11 ` [Bug c++/97237] " redi at gcc dot gnu.org
  2020-09-29 10:21 ` jakub at gcc dot gnu.org
@ 2020-09-29 10:43 ` redi at gcc dot gnu.org
  2020-10-16 12:19 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-09-29 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Toni Neubert from comment #0)
> The following valid code:

N.B. that's not valid at all. That's why you need to use -fpermissive to
compile it.


> But this code is valid in all versions:

No, it's invalid in all versions. It's only accepted with -fpermissive because
that means "please accept my broken code".

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
                   ` (2 preceding siblings ...)
  2020-09-29 10:43 ` redi at gcc dot gnu.org
@ 2020-10-16 12:19 ` rguenth at gcc dot gnu.org
  2020-10-24 20:09 ` lutztonineubert at gmail dot com
  2020-11-05  7:01 ` lutztonineubert at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-16 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
                   ` (3 preceding siblings ...)
  2020-10-16 12:19 ` rguenth at gcc dot gnu.org
@ 2020-10-24 20:09 ` lutztonineubert at gmail dot com
  2020-11-05  7:01 ` lutztonineubert at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: lutztonineubert at gmail dot com @ 2020-10-24 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Toni Neubert <lutztonineubert at gmail dot com> ---
This code seems to fail for the same reason:

constexpr int get() {
    [[maybe_unused]] auto i = 1 << 32;
    return 0;
}

template<auto a = get()>
constexpr int test() {
    return a;
}

constexpr int t1 = get();
constexpr int t2 = test();

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

* [Bug c++/97237] [10/11 Regression] static_assert does not accept fpermissive code
  2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
                   ` (4 preceding siblings ...)
  2020-10-24 20:09 ` lutztonineubert at gmail dot com
@ 2020-11-05  7:01 ` lutztonineubert at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: lutztonineubert at gmail dot com @ 2020-11-05  7:01 UTC (permalink / raw)
  To: gcc-bugs

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

Toni Neubert <lutztonineubert at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #5 from Toni Neubert <lutztonineubert at gmail dot com> ---
Closed this in favor of other bugs.

This isn't necessary at all. Sorry for your time.

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

end of thread, other threads:[~2020-11-05  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29  8:26 [Bug c++/97237] New: [10/11 Regression] static_assert does not accept fpermissive code lutztonineubert at gmail dot com
2020-09-29 10:11 ` [Bug c++/97237] " redi at gcc dot gnu.org
2020-09-29 10:21 ` jakub at gcc dot gnu.org
2020-09-29 10:43 ` redi at gcc dot gnu.org
2020-10-16 12:19 ` rguenth at gcc dot gnu.org
2020-10-24 20:09 ` lutztonineubert at gmail dot com
2020-11-05  7:01 ` lutztonineubert at gmail 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).