GCC modified for the FreeChainXenon project
Find a file
Dodji Seketeli 26f2269fc4 PR c++/54875 - Error with alias template that resolves to an enum
Consider this short example:

     1	template<typename T>
     2	using AddConst = T const;
     3
     4	enum FwdEnum : int;
     5
     6	int main() {
     7	  AddConst<FwdEnum> *ptr = nullptr;
     8	}

At line 7, when we build the type for AddConst<FwdEnum> in
lookup_template_class_1, the resulting type is the enum FwdEnum.  This
confuses lookup_template_class_1 near the if below, wrongly making it
taking the branch and thus calling tsubst_enum while it shouldn't:

      if (TREE_CODE (t) == ENUMERAL_TYPE && !is_dependent_type)
	/* Now that the type has been registered on the instantiations
	   list, we set up the enumerators.  Because the enumeration
	   constants may involve the enumeration type itself, we make
	   sure to register the type first, and then create the
	   constants.  That way, doing tsubst_expr for the enumeration
	   constants won't result in recursive calls here; we'll find
	   the instantiation and exit above.  */
	tsubst_enum (template_type, t, arglist);

Before the alias template feature, the only reason why TREE_CODE (t)
== ENUMERAL_TYPE would be true is when lookup_template_class_1 is
called for an enum that is a member of a class template.  But that
condition can be also true for an alias template instantiation.

So I guess that condition should be changed to TREE_CODE
(template_type) == ENUMERAL_TYPE, to specifically detect the member
enum of a class template case.  Note that for the alias template
instantiation case above, template_type points to a TEMPLATE_TYPE_PARM
which name is AddConst.

This is what the patchlet below does.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

	* pt.c (lookup_template_class_1): Look at the type of the
	potential member enum of class template to determine if we are
	actually substituting into a member enum of class template.

gcc/testsuite/

	* g++.dg/cpp0x/alias-decl-27.C: New test.

From-SVN: r193562
2012-11-16 16:20:03 +01:00
boehm-gc configure.ac: Add stanza for *-*-gnu* threads configuration. 2012-11-04 23:56:02 +01:00
config bid_functions.h: Check for __GLIBC__ additionally to LINUX when defining format specifiers. 2012-11-05 00:08:42 +01:00
contrib Update libsanitizer generated files 2012-11-14 03:09:00 -08:00
fixincludes It is October, not September. :) 2012-10-29 16:58:16 +00:00
gcc PR c++/54875 - Error with alias template that resolves to an enum 2012-11-16 16:20:03 +01:00
gnattools Remove obsolete IRIX 6.5 support 2012-03-14 16:33:37 +00:00
include Add C++ attribute abi_tag and -Wabi-tag option. 2012-11-09 11:14:37 -05:00
INSTALL README: Also refer to the online installation instructions. 2012-08-25 20:48:20 +00:00
intl
libada Makefile.in: Revert most changes. 2012-11-07 04:58:23 +00:00
libatomic acinclude.m4 (LIBAT_CHECK_IFUNC): Clarify message. 2012-11-05 00:27:03 +01:00
libbacktrace re PR other/55312 (libbacktrace doesn't honor --disable-werror) 2012-11-13 21:25:39 +00:00
libcpp Implement a flag -fext-numeric-literals that allows control of whether GNU... 2012-11-10 00:08:49 +00:00
libdecnumber bid_functions.h: Check for __GLIBC__ additionally to LINUX when defining format specifiers. 2012-11-05 00:08:42 +01:00
libffi linux64_closure.S: Add new ABI support. 2012-10-31 14:15:34 +10:30
libgcc soft-fp updated from GLIBC upstream. 2012-11-15 18:39:47 +00:00
libgfortran bessel.m4: Remove useless statement. 2012-10-28 17:54:44 +01:00
libgo syscall: Force first letter of error message to lower case. 2012-11-12 19:34:52 +00:00
libgomp Use -Wl,-undefined,dynamic_lookup on darwin 2012-11-07 15:12:27 -08:00
libiberty cp-demangle.c (d_unqualified_name): Handle abi tags here. 2012-11-10 21:11:15 -05:00
libitm Add HTM fastpath and use Intel RTM for it on x86. 2012-11-09 17:04:40 +00:00
libjava config.gcc: Match arm*-*-linux-* for ARM Linux/GNU. 2012-10-15 21:12:23 +00:00
libmudflap * configure: Regenerated. 2012-09-14 19:37:57 -04:00
libobjc rs6000-cpus.def (POWERPC_MASKS): Don't assume OPTION_MASK_STRICT_ALIGN is defined. 2012-10-19 19:10:03 +00:00
libquadmath fmaq.c (fmaq): Merge from GLIBC. 2012-11-15 18:22:21 +01:00
libsanitizer configure.ac: Invoke AM_MAINTAINER_MODE. 2012-11-16 15:19:15 +00:00
libssp * configure: Regenerated. 2012-09-14 19:40:25 -04:00
libstdc++-v3 re PR c++/55275 (abi_tag attribute doesn't work on explicit specializations of class templates) 2012-11-14 20:53:23 -05:00
lto-plugin * configure: Regenerated. 2012-09-14 19:42:24 -04:00
maintainer-scripts crontab: Disable snapshots from gcc-4_5-branch. 2012-07-02 09:16:29 +00:00
zlib * configure: Regenerated. 2012-09-14 19:43:33 -04:00
ABOUT-NLS
ChangeLog * MAINTAINERS (Write After Approval): Add myself. 2012-11-15 19:12:53 +00:00
ChangeLog.tree-ssa
compile
config-ml.in MAINTAINERS (crx port, [...]): Remove. 2011-03-22 19:58:18 +00:00
config.guess oops - omitted from previous delta. 2011-06-06 10:34:35 +00:00
config.rpath Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 11:45:53 +00:00
config.sub Update config.sub to 2012-04-18 version from official repo. 2012-04-25 15:48:28 +00:00
configure Consider *-*-nacl* targets ELF 2012-11-14 16:38:07 -08:00
configure.ac Consider *-*-nacl* targets ELF 2012-11-14 16:38:07 -08:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 re PR bootstrap/38607 (AIX error messages about TOC during build) 2012-09-14 19:23:41 -04:00
ltgcc.m4
ltmain.sh backport: ltmain.sh (relink): Use absolute path when hardcoding with -L. 2011-01-13 18:51:10 +00:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS * MAINTAINERS (Write After Approval): Add myself. 2012-11-15 19:12:53 +00:00
Makefile.def Import the asan runtime library into GCC tree 2012-11-12 16:53:47 +01:00
Makefile.in Import the asan runtime library into GCC tree 2012-11-12 16:53:47 +01:00
Makefile.tpl re PR bootstrap/54820 (ada: cannot find -lstdc++ since 4.8.0 20121002) 2012-10-22 07:27:21 +00:00
missing
mkdep
mkinstalldirs
move-if-change Import move-if-change script from gnulib. 2011-02-12 15:48:30 +00:00
README * README: Document use of ranges of years in copyright notices. 2012-07-16 15:01:34 +01:00
symlink-tree
ylwrap

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.