Marek Polacek de81e06273 c++: can't eval PTRMEM_CST in incomplete class [PR107574]
Here we're attempting to evaluate a PTRMEM_CST in a class that hasn't
been completed yet, but that doesn't work:

        /* We can't lower this until the class is complete.  */
        if (!COMPLETE_TYPE_P (DECL_CONTEXT (member)))
          return cst;

and then this unlowered PTRMEM_CST is used as EXPR in

    tree op1 = build_nop (ptrdiff_type_node, expr);

and we crash in a subsequent cp_fold_convert which gets type=ptrdiff_type_node,
expr=PTRMEM_CST and does

  else if (TREE_CODE (expr) == PTRMEM_CST
           && same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
                           PTRMEM_CST_CLASS (expr)))

where TYPE_PTRMEM_CLASS_TYPE (type) is going to crash since the type
is ptrdiff_type_node.  We could just add a TYPE_PTRMEM_P check before
accessing TYPE_PTRMEM_CLASS_TYPE but I think it's nicer to explain why
we couldn't evaluate the expression.

	PR c++/107574

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_constant_expression): Emit an error when
	a PTRMEM_CST cannot be evaluated.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/ptrmem-cst1.C: New test.
2023-03-01 18:32:04 -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-01 00:18:20 +00:00
2023-02-14 00:17:33 +00:00
2023-03-01 00:18:20 +00:00
2023-02-28 00:18:40 +00:00
2023-02-12 00:17:22 +00:00
2023-02-22 00:18:49 +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%