public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PSA: Default C++ dialect is now C++17
@ 2020-06-26 19:34 Marek Polacek
  2020-06-26 19:58 ` Marek Polacek
  2020-06-29  7:51 ` Martin Liška
  0 siblings, 2 replies; 10+ messages in thread
From: Marek Polacek @ 2020-06-26 19:34 UTC (permalink / raw)
  To: GCC Patches

As discussed last month:
<https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
it's time to change the C++ default to gnu++17.  I've committed the patch after
testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!

Marek


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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-26 19:34 PSA: Default C++ dialect is now C++17 Marek Polacek
@ 2020-06-26 19:58 ` Marek Polacek
  2020-06-29  7:51 ` Martin Liška
  1 sibling, 0 replies; 10+ messages in thread
From: Marek Polacek @ 2020-06-26 19:58 UTC (permalink / raw)
  To: GCC Patches

On Fri, Jun 26, 2020 at 03:34:09PM -0400, Marek Polacek via Gcc-patches wrote:
> As discussed last month:
> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
> it's time to change the C++ default to gnu++17.  I've committed the patch after
> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!

I've also updated wwwdocs to that effect:

commit 1528c44593180742ab827f9ea66d31e75b803de0
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Jun 26 15:56:12 2020 -0400

    The default C++ dialect in GCC 11 is C++17.

diff --git a/htdocs/gcc-11/changes.html b/htdocs/gcc-11/changes.html
index dc22f216..cea01a9c 100644
--- a/htdocs/gcc-11/changes.html
+++ b/htdocs/gcc-11/changes.html
@@ -30,6 +30,9 @@ a work-in-progress.</p>
 <!-- .................................................................. -->
 <h2>Caveats</h2>
 <ul>
+  <li>The default mode for C++ is now <code>-std=gnu++17</code> instead of
+      <code>-std=gnu++14</code>.</li>
+
   <li>Naming and location of auxiliary and dump output files changed.
       If you compile multiple input files in a single command, if you
       enable Link Time Optimization, or if you use <code>-dumpbase</code>,
@@ -72,6 +75,7 @@ a work-in-progress.</p>
 
 <h3 id="cxx">C++</h3>
 <ul>
+  <li>The default mode has been changed to <code>-std=gnu++17</code>.</li>
   <li>Several C++ Defect Reports have been resolved, e.g.:
   <ul>
     <li>DR 1512, Pointer comparison vs qualification conversions</li>
diff --git a/htdocs/projects/cxx-status.html b/htdocs/projects/cxx-status.html
index b5cdd1a9..ed1a3440 100644
--- a/htdocs/projects/cxx-status.html
+++ b/htdocs/projects/cxx-status.html
@@ -577,11 +577,10 @@
   <a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017">the library documentation</a>.
   </p>
 
-  <p>C++17 features are available since GCC 5. To enable C++17
-      support, add the command-line parameter <code>-std=c++17</code>
-      to your <code>g++</code> command line. Or, to enable GNU
-      extensions in addition to C++17 features,
-    add <code>-std=gnu++17</code>.</p>
+  <p>C++17 features are available since GCC 5.  This mode is the default
+  in GCC 11; it can be explicitly selected with the <code>-std=c++17</code>
+  command-line flag, or <code>-std=gnu++17</code> to enable GNU extensions
+  as well.</p>
 
   <h2>C++17 Language Features</h2>
 
@@ -902,8 +901,8 @@
   <p>GCC has full support for the previous revision of the C++
   standard, which was published in 2014.</p>
 
-  <p>This mode is the default in GCC 6.1 and above; it can be explicitly
-  selected with the <code>-std=c++14</code> command-line flag,
+  <p>This mode is the default in GCC 6.1 up until GCC 10 (including); it can
+  be explicitly selected with the <code>-std=c++14</code> command-line flag,
   or <code>-std=gnu++14</code> to enable GNU extensions as well.</p>
 
   <h2>C++14 Language Features</h2>


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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-26 19:34 PSA: Default C++ dialect is now C++17 Marek Polacek
  2020-06-26 19:58 ` Marek Polacek
@ 2020-06-29  7:51 ` Martin Liška
  2020-06-29 14:57   ` Marek Polacek
  2020-06-29 18:11   ` Martin Liška
  1 sibling, 2 replies; 10+ messages in thread
From: Martin Liška @ 2020-06-29  7:51 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
> As discussed last month:
> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
> it's time to change the C++ default to gnu++17.  I've committed the patch after
> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
> 
> Marek
> 

Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
with default changed to -std=c++17. The spec config needs to be adjusted.

Martin

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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-29  7:51 ` Martin Liška
@ 2020-06-29 14:57   ` Marek Polacek
  2020-06-29 17:24     ` Martin Liška
  2020-06-29 18:11   ` Martin Liška
  1 sibling, 1 reply; 10+ messages in thread
From: Marek Polacek @ 2020-06-29 14:57 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote:
> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
> > As discussed last month:
> > <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
> > it's time to change the C++ default to gnu++17.  I've committed the patch after
> > testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
> > 
> > Marek
> > 
> 
> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
> with default changed to -std=c++17. The spec config needs to be adjusted.

Interesting, do you know why?  Does it use the register keyword?

Marek


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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-29 14:57   ` Marek Polacek
@ 2020-06-29 17:24     ` Martin Liška
  2020-09-14 15:13       ` Jason Merrill
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Liška @ 2020-06-29 17:24 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches

On 6/29/20 4:57 PM, Marek Polacek wrote:
> On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote:
>> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
>>> As discussed last month:
>>> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
>>> it's time to change the C++ default to gnu++17.  I've committed the patch after
>>> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
>>>
>>> Marek
>>>
>>
>> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
>> with default changed to -std=c++17. The spec config needs to be adjusted.
> 
> Interesting, do you know why?  Does it use the register keyword?

Apparently it needs -fno-new-ttp-matching for successful compilation.
There's a reduced test-case I made:

cat fe.ii
template <int, int> class FiniteElement;
template <int, int> class DoFHandler;
class FETools {
   template <int dim, class InVector, class OutVector, int spacedim>
   void back_interpolate(const DoFHandler<dim, spacedim> &, const InVector &,
                         const FiniteElement<dim, spacedim> &, OutVector &);
   template <int dim, template <int> class DH, class InVector, class OutVector,
             int spacedim>
   void back_interpolate(const DH<dim> &, InVector,
                         const FiniteElement<dim, spacedim> &, OutVector);
};
template <int dim, int = dim> class DoFHandler;
template <int dim, int = dim> class FiniteElement;
template <int dim, class InVector, class OutVector, int spacedim>
void FETools::back_interpolate(const DoFHandler<dim, spacedim> &,
                                const InVector &,
                                const FiniteElement<dim, spacedim> &,
                                OutVector &) {}
template void FETools::back_interpolate(const DoFHandler<3> &, const float &,
                                         const FiniteElement<3> &, float &);

Martin

> 
> Marek
> 


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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-29  7:51 ` Martin Liška
  2020-06-29 14:57   ` Marek Polacek
@ 2020-06-29 18:11   ` Martin Liška
  2020-06-30  9:16     ` Tamar Christina
  1 sibling, 1 reply; 10+ messages in thread
From: Martin Liška @ 2020-06-29 18:11 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

On 6/29/20 9:51 AM, Martin Liška wrote:
> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
>> As discussed last month:
>> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
>> it's time to change the C++ default to gnu++17.  I've committed the patch after
>> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
>>
>> Marek
>>
> 
> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
> with default changed to -std=c++17. The spec config needs to be adjusted.
> 
> Martin

And there one another failure in 520.omnetpp_r caused by run-time error:
<!> Error during startup: Register_Function() or cMathFunction: attempt to register function "SPEC_HYPOT" with wrong number of arguments 2, should be 3.

which is about call of std::__hypot3 which has newly 3 args since c++ 17:
https://en.cppreference.com/w/cpp/numeric/math/hypot

Martin

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

* RE: PSA: Default C++ dialect is now C++17
  2020-06-29 18:11   ` Martin Liška
@ 2020-06-30  9:16     ` Tamar Christina
  0 siblings, 0 replies; 10+ messages in thread
From: Tamar Christina @ 2020-06-30  9:16 UTC (permalink / raw)
  To: Martin Liška, Marek Polacek, GCC Patches

> >>
> >
> > Just a small note that 510.parest_r SPEC 2017 benchmark can't be built
> > now with default changed to -std=c++17. The spec config needs to be
> adjusted.
> >
> > Martin
> 
> And there one another failure in 520.omnetpp_r caused by run-time error:
> <!> Error during startup: Register_Function() or cMathFunction: attempt to
> register function "SPEC_HYPOT" with wrong number of arguments 2, should
> be 3.
> 
> which is about call of std::__hypot3 which has newly 3 args since c++ 17:
> https://en.cppreference.com/w/cpp/numeric/math/hypot
> 

Thanks!, I was scratching my head where this error came from..

Regards,
Tamar

> Martin


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

* Re: PSA: Default C++ dialect is now C++17
  2020-06-29 17:24     ` Martin Liška
@ 2020-09-14 15:13       ` Jason Merrill
  2020-09-15  1:17         ` Marek Polacek
  0 siblings, 1 reply; 10+ messages in thread
From: Jason Merrill @ 2020-09-14 15:13 UTC (permalink / raw)
  To: Martin Liška; +Cc: Marek Polacek, GCC Patches

On Mon, Jun 29, 2020 at 1:25 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 6/29/20 4:57 PM, Marek Polacek wrote:
> > On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote:
> >> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
> >>> As discussed last month:
> >>> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
> >>> it's time to change the C++ default to gnu++17.  I've committed the patch after
> >>> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
> >>>
> >>> Marek
> >>>
> >>
> >> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
> >> with default changed to -std=c++17. The spec config needs to be adjusted.
> >
> > Interesting, do you know why?  Does it use the register keyword?
>
> Apparently it needs -fno-new-ttp-matching for successful compilation.
> There's a reduced test-case I made:
>
> cat fe.ii
> template <int, int> class FiniteElement;
> template <int, int> class DoFHandler;
> class FETools {
>    template <int dim, class InVector, class OutVector, int spacedim>
>    void back_interpolate(const DoFHandler<dim, spacedim> &, const InVector &,
>                          const FiniteElement<dim, spacedim> &, OutVector &);
>    template <int dim, template <int> class DH, class InVector, class OutVector,
>              int spacedim>
>    void back_interpolate(const DH<dim> &, InVector,
>                          const FiniteElement<dim, spacedim> &, OutVector);
> };
> template <int dim, int = dim> class DoFHandler;
> template <int dim, int = dim> class FiniteElement;
> template <int dim, class InVector, class OutVector, int spacedim>
> void FETools::back_interpolate(const DoFHandler<dim, spacedim> &,
>                                 const InVector &,
>                                 const FiniteElement<dim, spacedim> &,
>                                 OutVector &) {}
> template void FETools::back_interpolate(const DoFHandler<3> &, const float &,
>                                          const FiniteElement<3> &, float &);

Hmm, looks like I never sent this.

Further reduced:

template <int N, int M = N> class A;
template <int N, int M> void fn(A<N, M> &) {}
template <int N, template <int> class TT>  void fn(TT<N> &);
template void fn(A<3> &);

This breaks due to the C++17 changes to template template parameters
causing A to now be considered a valid argument for TT; with that
change both function templates are valid candidates, and neither is
more specialized than the other, so it's ambiguous.

There are still some open core issues around these changes.


Jason


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

* Re: PSA: Default C++ dialect is now C++17
  2020-09-14 15:13       ` Jason Merrill
@ 2020-09-15  1:17         ` Marek Polacek
  2020-09-15 15:36           ` Jeff Law
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Polacek @ 2020-09-15  1:17 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Martin Liška, GCC Patches

On Mon, Sep 14, 2020 at 11:13:18AM -0400, Jason Merrill via Gcc-patches wrote:
> On Mon, Jun 29, 2020 at 1:25 PM Martin Liška <mliska@suse.cz> wrote:
> >
> > On 6/29/20 4:57 PM, Marek Polacek wrote:
> > > On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote:
> > >> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
> > >>> As discussed last month:
> > >>> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
> > >>> it's time to change the C++ default to gnu++17.  I've committed the patch after
> > >>> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
> > >>>
> > >>> Marek
> > >>>
> > >>
> > >> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
> > >> with default changed to -std=c++17. The spec config needs to be adjusted.
> > >
> > > Interesting, do you know why?  Does it use the register keyword?
> >
> > Apparently it needs -fno-new-ttp-matching for successful compilation.
> > There's a reduced test-case I made:
> >
> > cat fe.ii
> > template <int, int> class FiniteElement;
> > template <int, int> class DoFHandler;
> > class FETools {
> >    template <int dim, class InVector, class OutVector, int spacedim>
> >    void back_interpolate(const DoFHandler<dim, spacedim> &, const InVector &,
> >                          const FiniteElement<dim, spacedim> &, OutVector &);
> >    template <int dim, template <int> class DH, class InVector, class OutVector,
> >              int spacedim>
> >    void back_interpolate(const DH<dim> &, InVector,
> >                          const FiniteElement<dim, spacedim> &, OutVector);
> > };
> > template <int dim, int = dim> class DoFHandler;
> > template <int dim, int = dim> class FiniteElement;
> > template <int dim, class InVector, class OutVector, int spacedim>
> > void FETools::back_interpolate(const DoFHandler<dim, spacedim> &,
> >                                 const InVector &,
> >                                 const FiniteElement<dim, spacedim> &,
> >                                 OutVector &) {}
> > template void FETools::back_interpolate(const DoFHandler<3> &, const float &,
> >                                          const FiniteElement<3> &, float &);
> 
> Hmm, looks like I never sent this.
> 
> Further reduced:
> 
> template <int N, int M = N> class A;
> template <int N, int M> void fn(A<N, M> &) {}
> template <int N, template <int> class TT>  void fn(TT<N> &);
> template void fn(A<3> &);
> 
> This breaks due to the C++17 changes to template template parameters
> causing A to now be considered a valid argument for TT; with that
> change both function templates are valid candidates, and neither is
> more specialized than the other, so it's ambiguous.
> 
> There are still some open core issues around these changes.

Thanks.  I just pushed a patch to introduce GCC 11 porting_to:
<https://gcc.gnu.org/gcc-11/porting_to.html> and documented this change.

Let me know if you have any comments.

Marek


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

* Re: PSA: Default C++ dialect is now C++17
  2020-09-15  1:17         ` Marek Polacek
@ 2020-09-15 15:36           ` Jeff Law
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Law @ 2020-09-15 15:36 UTC (permalink / raw)
  To: Marek Polacek, Jason Merrill; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 3283 bytes --]


On 9/14/20 7:17 PM, Marek Polacek via Gcc-patches wrote:
> On Mon, Sep 14, 2020 at 11:13:18AM -0400, Jason Merrill via Gcc-patches wrote:
>> On Mon, Jun 29, 2020 at 1:25 PM Martin Liška <mliska@suse.cz> wrote:
>>> On 6/29/20 4:57 PM, Marek Polacek wrote:
>>>> On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote:
>>>>> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote:
>>>>>> As discussed last month:
>>>>>> <https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545879.html>
>>>>>> it's time to change the C++ default to gnu++17.  I've committed the patch after
>>>>>> testing x86_64-pc-linux-gnu and powerpc64le-unknown-linux-gnu.  Brace yourselves!
>>>>>>
>>>>>> Marek
>>>>>>
>>>>> Just a small note that 510.parest_r SPEC 2017 benchmark can't be built now
>>>>> with default changed to -std=c++17. The spec config needs to be adjusted.
>>>> Interesting, do you know why?  Does it use the register keyword?
>>> Apparently it needs -fno-new-ttp-matching for successful compilation.
>>> There's a reduced test-case I made:
>>>
>>> cat fe.ii
>>> template <int, int> class FiniteElement;
>>> template <int, int> class DoFHandler;
>>> class FETools {
>>>    template <int dim, class InVector, class OutVector, int spacedim>
>>>    void back_interpolate(const DoFHandler<dim, spacedim> &, const InVector &,
>>>                          const FiniteElement<dim, spacedim> &, OutVector &);
>>>    template <int dim, template <int> class DH, class InVector, class OutVector,
>>>              int spacedim>
>>>    void back_interpolate(const DH<dim> &, InVector,
>>>                          const FiniteElement<dim, spacedim> &, OutVector);
>>> };
>>> template <int dim, int = dim> class DoFHandler;
>>> template <int dim, int = dim> class FiniteElement;
>>> template <int dim, class InVector, class OutVector, int spacedim>
>>> void FETools::back_interpolate(const DoFHandler<dim, spacedim> &,
>>>                                 const InVector &,
>>>                                 const FiniteElement<dim, spacedim> &,
>>>                                 OutVector &) {}
>>> template void FETools::back_interpolate(const DoFHandler<3> &, const float &,
>>>                                          const FiniteElement<3> &, float &);
>> Hmm, looks like I never sent this.
>>
>> Further reduced:
>>
>> template <int N, int M = N> class A;
>> template <int N, int M> void fn(A<N, M> &) {}
>> template <int N, template <int> class TT>  void fn(TT<N> &);
>> template void fn(A<3> &);
>>
>> This breaks due to the C++17 changes to template template parameters
>> causing A to now be considered a valid argument for TT; with that
>> change both function templates are valid candidates, and neither is
>> more specialized than the other, so it's ambiguous.
>>
>> There are still some open core issues around these changes.
> Thanks.  I just pushed a patch to introduce GCC 11 porting_to:
> <https://gcc.gnu.org/gcc-11/porting_to.html> and documented this change.
>
> Let me know if you have any comments.

And I just pushed a placeholder into that file for a few other things
I've seen during Fedora testing.  I thought I'd pushed my initial gcc-11
porting_to a month or so ago.  Apparently not :(


jeff


[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1763 bytes --]

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

end of thread, other threads:[~2020-09-15 15:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 19:34 PSA: Default C++ dialect is now C++17 Marek Polacek
2020-06-26 19:58 ` Marek Polacek
2020-06-29  7:51 ` Martin Liška
2020-06-29 14:57   ` Marek Polacek
2020-06-29 17:24     ` Martin Liška
2020-09-14 15:13       ` Jason Merrill
2020-09-15  1:17         ` Marek Polacek
2020-09-15 15:36           ` Jeff Law
2020-06-29 18:11   ` Martin Liška
2020-06-30  9:16     ` Tamar Christina

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).