GCC modified for the FreeChainXenon project
![]() 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 |
||
---|---|---|
boehm-gc | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libjava | ||
libmudflap | ||
libobjc | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
ABOUT-NLS | ||
ChangeLog | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
README | ||
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.