[PATCH C++] - SD-6 Implementation Part 2 - __has_include macro and C++ language feature macros.

Jason Merrill jason@redhat.com
Thu Sep 25 17:37:00 GMT 2014


On 09/01/2014 09:41 PM, Ed Smith-Rowland wrote:
> +	  /* Return type deduction was added as an extension to C++11
> +	     and was standardized for C+14.  */
> +	  cpp_define (pfile, "__cpp_return_type_deduction=201304");

When I try to use it with -std=c++11 I get

wa.C:1:8: error: ‘f’ function uses ‘auto’ type specifier without 
trailing return type
  auto f() { return 42; }
         ^
wa.C:1:8: note: deduced return type only available with -std=c++14 or 
-std=gnu++14

Let's move it to the C++14 section.

> There is one bit: arrays of runtime bound.  These got kicked out of C++14 I think and is languishing in a TS.
> OTOH, we still support it.  It's better than the C99 version we supported.
> What direction should I take?
> /* .... Runtime sized arrays
> +	 have C++14 semantics even for C++98.  */

The comment is inaccurate; most of the restrictions on arrays of runtime 
bound are only applied in C++14 mode.  Let's put this macro in the C++14 
section as well until there's a value or separate macro indicating C99 
VLA support.

Jason



More information about the Gcc-patches mailing list