Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #91179 > unrolled thread

typedef structures broken

Started byMalcolm McLean <malcolm.arthur.mclean@gmail.com>
First post2023-07-22 01:21 -0700
Last post2023-07-22 09:34 -0700
Articles 6 — 4 participants

Back to article view | Back to comp.lang.c++


Contents

  typedef structures broken Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-22 01:21 -0700
    Re: typedef structures broken Bonita Montero <Bonita.Montero@gmail.com> - 2023-07-22 11:20 +0200
    Re: typedef structures broken Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-07-22 03:45 -0700
      Re: typedef structures broken Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-22 04:21 -0700
    Re: typedef structures broken David Brown <david.brown@hesbynett.no> - 2023-07-22 17:50 +0200
      Re: typedef structures broken Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-22 09:34 -0700

#91179 — typedef structures broken

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2023-07-22 01:21 -0700
Subjecttypedef structures broken
Message-ID<222d1ba1-131d-4d6a-89f6-ddbd2082db01n@googlegroups.com>
Windows Visual C++ is now rejecting typedefed structures without tags.

e.g the following code

typedef struct
{
    double x;
    double y;
} Point;

clang still accepts it.

Anyone more information on this?

[toc] | [next] | [standalone]


#91180

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-07-22 11:20 +0200
Message-ID<u9g70k$3otl1$1@dont-email.me>
In reply to#91179
Am 22.07.2023 um 10:21 schrieb Malcolm McLean:
> Windows Visual C++ is now rejecting typedefed structures without tags.
> 
> e.g the following code
> 
> typedef struct
> {
>      double x;
>      double y;
> } Point;

I can compile this with current MSVC and -std:C++14, -std:C++17
and -std:C++20.

[toc] | [prev] | [next] | [standalone]


#91181

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2023-07-22 03:45 -0700
Message-ID<87wmysmdhp.fsf@nosuchdomain.example.com>
In reply to#91179
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> Windows Visual C++ is now rejecting typedefed structures without tags.
>
> e.g the following code
>
> typedef struct
> {
>     double x;
>     double y;
> } Point;
>
> clang still accepts it.
>
> Anyone more information on this?

What's the error message?

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#91182

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2023-07-22 04:21 -0700
Message-ID<12fb1738-87cc-4098-a3dc-b5cecf636679n@googlegroups.com>
In reply to#91181
On Saturday, 22 July 2023 at 11:45:23 UTC+1, Keith Thompson wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes: 
> > Windows Visual C++ is now rejecting typedefed structures without tags. 
> > 
> > e.g the following code 
> > 
> > typedef struct 
> > { 
> > double x; 
> > double y; 
> > } Point; 
> > 
> > clang still accepts it. 
> > 
> > Anyone more information on this?
> What's the error message? 
> 
> 
It broke on an Azure build. 
(Azure is a system which hosts compilers in the cloud. I develop on the Mac then submit
the programs. Azure builds a Windows compatible version. But I can't easily regenerate
the error message.) It was something like struct tag missing.

[toc] | [prev] | [next] | [standalone]


#91183

FromDavid Brown <david.brown@hesbynett.no>
Date2023-07-22 17:50 +0200
Message-ID<u9gtrt$3s62g$1@dont-email.me>
In reply to#91179
On 22/07/2023 10:21, Malcolm McLean wrote:
> Windows Visual C++ is now rejecting typedefed structures without tags.
> 
> e.g the following code
> 
> typedef struct
> {
>      double x;
>      double y;
> } Point;
> 
> clang still accepts it.
> 
> Anyone more information on this?

Pasting it into godbolt and testing with the latest MSVC does not 
complain.  But I don't know the command-line switches involved.

Perhaps you have particular switches that make it reject this, even 
though it is valid code (AFAIK) ?

[toc] | [prev] | [next] | [standalone]


#91184

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2023-07-22 09:34 -0700
Message-ID<b48ff76a-4a05-41d7-bc8f-f35fa53772a1n@googlegroups.com>
In reply to#91183
On Saturday, 22 July 2023 at 16:50:40 UTC+1, David Brown wrote:
> On 22/07/2023 10:21, Malcolm McLean wrote: 
> > Windows Visual C++ is now rejecting typedefed structures without tags. 
> > 
> > e.g the following code 
> > 
> > typedef struct 
> > { 
> > double x; 
> > double y; 
> > } Point; 
> > 
> > clang still accepts it. 
> > 
> > Anyone more information on this?
> Pasting it into godbolt and testing with the latest MSVC does not 
> complain. But I don't know the command-line switches involved. 
> 
> Perhaps you have particular switches that make it reject this, even 
> though it is valid code (AFAIK) ?
>
With Azure pipelines the pipeline is usually set up by other people who
choose the compiler version and the flags. This avoids a situation in which
a developer sets various esoteric options on his desktop and creates an
executable, which can't be replicated by anyone else. But the disadvantage is
that you don't actually know how it's been set up.

But something has gone wrong. I cut and pasted C circle drawing code into a .cpp
file. And it rejected the typedef. When I converted the structure to the C++
idomatic form ( struct MyStructure { }; ), it was accepted.

 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web