Marek Polacek e09bc034d1 c++: error with constexpr operator() [PR107939]
Similarly to PR107938, this also started with r11-557, whereby cp_finish_decl
can call check_initializer even in a template for a constexpr initializer.

Here we are rejecting

  extern const Q q;

  template<int>
  constexpr auto p = q(0);

even though q has a constexpr operator().  It's deemed non-const by
decl_maybe_constant_var_p because even though 'q' is const it is not
of integral/enum type.

If fun is not a function pointer, we don't know if we're using it as an
lvalue or rvalue, so with this patch we pass 'any' for want_rval.  With
that, p_c_e/VAR_DECL doesn't flat out reject the underlying VAR_DECL.

	PR c++/107939

gcc/cp/ChangeLog:

	* constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>: Pass
	'any' when recursing on a VAR_DECL and not a pointer to function.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/var-templ74.C: Remove dg-error.
	* g++.dg/cpp1y/var-templ77.C: New test.
2023-03-07 09:51:52 -05:00
2023-02-23 00:17:57 +00:00
2023-02-18 00:17:20 +00:00
2023-02-28 00:18:40 +00:00
2023-03-04 00:16:30 +00:00
2023-03-01 00:18:20 +00:00
2023-03-07 00:16:44 +00:00
2023-03-01 00:18:20 +00:00
2023-02-28 00:18:40 +00:00
2023-03-03 00:16:38 +00:00
2023-03-04 00:16:30 +00:00
2023-02-22 00:18:49 +00:00
2023-03-03 00:16:38 +00:00
2023-03-04 00:16:30 +00:00
2023-02-17 00:17:49 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
S
Description
Yggdrasil port of the GNU Compiler Collection
Readme 978 MiB
Languages
C++ 33%
C 27.4%
Ada 13%
Go 7.1%
D 7%
Other 12.1%