public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr
@ 2021-08-01  2:11 steve_green at qq dot com
  2021-08-01  2:17 ` [Bug c++/101710] " steve_green at qq dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: steve_green at qq dot com @ 2021-08-01  2:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101710
           Summary: Sometimes constexpr cannot be used as constexpr
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: steve_green at qq dot com
  Target Milestone: ---

Created attachment 51231
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51231&action=edit
.ii file & .s file & output

I want to make a minimal reproduction of this ICE, but it seems I can't
So allow me to post a link to the project, sorry


You can try to compile this file
https://github.com/ELC-lang/ELC/blob/master/parts/header_file/test/forICE.cpp

In MSVC, the compilation of this file will stop due to some ICE, but it is
different from ICEs that GCC have 
The problem with GCC is that all "error: expected primary-expression before ‘X’
token" can be compiled in MSVC

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
@ 2021-08-01  2:17 ` steve_green at qq dot com
  2021-08-01  8:22 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: steve_green at qq dot com @ 2021-08-01  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

steve02081504 <steve_green at qq dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #51231|0                           |1
        is obsolete|                            |

--- Comment #1 from steve02081504 <steve_green at qq dot com> ---
Created attachment 51232
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51232&action=edit
.ii file & .s file & output

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
  2021-08-01  2:17 ` [Bug c++/101710] " steve_green at qq dot com
@ 2021-08-01  8:22 ` pinskia at gcc dot gnu.org
  2021-08-01  8:25 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-01  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you re-upload the zip file as it seems be corrupted?

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
  2021-08-01  2:17 ` [Bug c++/101710] " steve_green at qq dot com
  2021-08-01  8:22 ` pinskia at gcc dot gnu.org
@ 2021-08-01  8:25 ` pinskia at gcc dot gnu.org
  2021-08-01  8:26 ` steve_green at qq dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-01  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Can you re-upload the zip file as it seems be corrupted?

Never mind, I was able to extract it, I had to use winrar rather than the
builtin unziper in windows or Info-ZIP unzip on Linux.

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
                   ` (2 preceding siblings ...)
  2021-08-01  8:25 ` pinskia at gcc dot gnu.org
@ 2021-08-01  8:26 ` steve_green at qq dot com
  2021-08-01  8:28 ` steve_green at qq dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: steve_green at qq dot com @ 2021-08-01  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from steve02081504 <steve_green at qq dot com> ---
Created attachment 51235
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51235&action=edit
.ii file & .s file & output - Deflate64

Deflate64 zip added.

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
                   ` (3 preceding siblings ...)
  2021-08-01  8:26 ` steve_green at qq dot com
@ 2021-08-01  8:28 ` steve_green at qq dot com
  2021-08-01  8:42 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: steve_green at qq dot com @ 2021-08-01  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from steve02081504 <steve_green at qq dot com> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > Can you re-upload the zip file as it seems be corrupted?
> 
> Never mind, I was able to extract it, I had to use winrar rather than the
> builtin unziper in windows or Info-ZIP unzip on Linux.

Sorry, I think I used LZMA format in the compressed package, which is probably
not supported by the standard ZIP format.

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
                   ` (4 preceding siblings ...)
  2021-08-01  8:28 ` steve_green at qq dot com
@ 2021-08-01  8:42 ` pinskia at gcc dot gnu.org
  2021-08-01  8:54 ` pinskia at gcc dot gnu.org
  2021-08-01  8:59 ` steve_green at qq dot com
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-01  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Changing:
  if
constexpr(type_info<T>.has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.not_has_has_attribute_helper<force_use_default_null_ptr>())

to:
  if constexpr(type_info<T>.template
has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.template
not_has_has_attribute_helper<force_use_default_null_ptr>())

Fixes many of the errors
Note the use of template.

Note there are cases where GCC does not realize the template keyword is not
needed but I don't know if it is actually needed in this case or not.  I
suspect it is.

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
                   ` (5 preceding siblings ...)
  2021-08-01  8:42 ` pinskia at gcc dot gnu.org
@ 2021-08-01  8:54 ` pinskia at gcc dot gnu.org
  2021-08-01  8:59 ` steve_green at qq dot com
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-01  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> Changing:
>   if
> constexpr(type_info<T>.
> has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.
> not_has_has_attribute_helper<force_use_default_null_ptr>())
> 
> to:
>   if constexpr(type_info<T>.template
> has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.template
> not_has_has_attribute_helper<force_use_default_null_ptr>())
> 
> Fixes many of the errors
> Note the use of template.

This shows up in many places in your files.

There was two other errors I noticed:
* aligned_alloc is not defined; mingw does not define aligned_alloc I think.
* is_pointer<T> should have been std::is_pointer_v<T> as far as I can tell.

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

* [Bug c++/101710] Sometimes constexpr cannot be used as constexpr
  2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
                   ` (6 preceding siblings ...)
  2021-08-01  8:54 ` pinskia at gcc dot gnu.org
@ 2021-08-01  8:59 ` steve_green at qq dot com
  7 siblings, 0 replies; 9+ messages in thread
From: steve_green at qq dot com @ 2021-08-01  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

steve02081504 <steve_green at qq dot com> changed:

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

--- Comment #8 from steve02081504 <steve_green at qq dot com> ---
(In reply to Andrew Pinski from comment #6)
> Changing:
>   if
> constexpr(type_info<T>.
> has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.
> not_has_has_attribute_helper<force_use_default_null_ptr>())
> 
> to:
>   if constexpr(type_info<T>.template
> has_attribute_helper<can_t_use_default_null_ptr>()&&type_info<T>.template
> not_has_has_attribute_helper<force_use_default_null_ptr>())
> 
> Fixes many of the errors
> Note the use of template.
> 
> Note there are cases where GCC does not realize the template keyword is not
> needed but I don't know if it is actually needed in this case or not.  I
> suspect it is.

So I just need to add "template" to these errors?
Well, although it doesn't look very beautiful, I think I latched on
This is my code's problem, not GCC's ICE, right
thank you

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

end of thread, other threads:[~2021-08-01  8:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01  2:11 [Bug c++/101710] New: Sometimes constexpr cannot be used as constexpr steve_green at qq dot com
2021-08-01  2:17 ` [Bug c++/101710] " steve_green at qq dot com
2021-08-01  8:22 ` pinskia at gcc dot gnu.org
2021-08-01  8:25 ` pinskia at gcc dot gnu.org
2021-08-01  8:26 ` steve_green at qq dot com
2021-08-01  8:28 ` steve_green at qq dot com
2021-08-01  8:42 ` pinskia at gcc dot gnu.org
2021-08-01  8:54 ` pinskia at gcc dot gnu.org
2021-08-01  8:59 ` steve_green at qq 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).