GNU bug report logs - #59992
[PATCH 1/2] tests: Fix 'type defaults' error in link_cond due to main not being properly declared

Previous Next

Package: automake-patches;

Reported by: Frederic Berat <fberat <at> redhat.com>

Date: Mon, 12 Dec 2022 08:44:04 UTC

Severity: wishlist

Tags: patch

Done: Mike Frysinger <vapier <at> gentoo.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 59992 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Zack Weinberg <zack <at> owlfolio.org>
Cc: 59992 <at> debbugs.gnu.org
Subject: Re: [bug#59992] [PATCH 1/2] tests: Fix 'type defaults' error in
 link_cond due to main not being properly declared
Date: Thu, 15 Dec 2022 08:12:35 +0100
For the record:

cat > less.c <<'END'
/* Valid C but deliberately invalid C++ */
int main (void)
{
  int new = 0;
  return new;
}
END

$> g++ less.c
less.c: In function ‘int main()’:
less.c:4:7: error: expected unqualified-id before ‘new’
    4 |   int new = 0;
      |       ^~~
less.c:5:13: error: expected type-specifier before ‘;’ token
    5 |   return new;
      |             ^


On Tue, Dec 13, 2022 at 7:35 AM Frederic Berat <fberat <at> redhat.com> wrote:
>
> On Mon, Dec 12, 2022 at 9:15 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
> >
> > On 2022-12-12 2:05 AM, Frederic Berat wrote:
> > > This is related to an effort to prepare Automake for future GCC/Clang
> > > versions which set c99 as default standard to be used.
> > > Not properly declaring main as "int main(...)" is rejected since c99.
> > ...
> > >   /* Valid C but deliberately invalid C++ */
> > > -main ()
> > > +int main (void)
> >
> > Note the comment.  Is this test program still invalid C++ after your change?
>
> I assumed yes, since "new" should be a standard symbol, but I actually
> forgot to double check.
>
> >
> > zw
> >
> >
> >
> >





This bug report was last modified 2 years and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.