public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113587] New: Compile error with #pragma (end)region
@ 2024-01-24 17:20 liavonlida at gmail dot com
  2024-01-24 17:26 ` [Bug c++/113587] " pinskia at gcc dot gnu.org
  2024-01-24 17:27 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: liavonlida at gmail dot com @ 2024-01-24 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113587
           Summary: Compile error with #pragma (end)region
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liavonlida at gmail dot com
  Target Milestone: ---

I tried GCC 13.1 and got a compile error with valid code.

Mininal sample is:

void f()
{
#pragma region Shape
        if (true)
        {
        } 
#pragma endregion Shape
        else if (true)
        {
        } 
}

result is:
<source>: In function 'void f()':
<source>:9:25: error: 'else' without a previous 'if'
    9 |                         else if (true)
      |                         ^~~~

It's fine with:
GCC <= 12 and MSVC

GCC 13 and later (trunk) fails on it.

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

* [Bug c++/113587] Compile error with #pragma (end)region
  2024-01-24 17:20 [Bug c++/113587] New: Compile error with #pragma (end)region liavonlida at gmail dot com
@ 2024-01-24 17:26 ` pinskia at gcc dot gnu.org
  2024-01-24 17:27 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note GCC treats `#pragma`s in some (maybe most) cases as statements which is
the effect you are seeing here.

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

* [Bug c++/113587] Compile error with #pragma (end)region
  2024-01-24 17:20 [Bug c++/113587] New: Compile error with #pragma (end)region liavonlida at gmail dot com
  2024-01-24 17:26 ` [Bug c++/113587] " pinskia at gcc dot gnu.org
@ 2024-01-24 17:27 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 63326 (via a dup of bug 111758).

*** This bug has been marked as a duplicate of bug 63326 ***

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

end of thread, other threads:[~2024-01-24 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 17:20 [Bug c++/113587] New: Compile error with #pragma (end)region liavonlida at gmail dot com
2024-01-24 17:26 ` [Bug c++/113587] " pinskia at gcc dot gnu.org
2024-01-24 17:27 ` pinskia 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).