Commit 4bbff96e by Jason Merrill Committed by Jason Merrill

re PR c++/49932 ([C++0x] ICE on instantiating decltype(expr)::type with template)

	PR c++/49932
gcc/cp/
	* mangle.c (write_prefix): Handle decltype.
libiberty/
	* cp-demangle.c (d_prefix): Handle decltype.

From-SVN: r177074
parent 3748a54c
2011-08-01 Jason Merrill <jason@redhat.com> 2011-08-01 Jason Merrill <jason@redhat.com>
PR c++/49932
* mangle.c (write_prefix): Handle decltype.
PR c++/49924 PR c++/49924
* semantics.c (cxx_eval_vec_init_1): Fix logic. * semantics.c (cxx_eval_vec_init_1): Fix logic.
......
...@@ -952,6 +952,7 @@ write_nested_name (const tree decl) ...@@ -952,6 +952,7 @@ write_nested_name (const tree decl)
/* <prefix> ::= <prefix> <unqualified-name> /* <prefix> ::= <prefix> <unqualified-name>
::= <template-param> ::= <template-param>
::= <template-prefix> <template-args> ::= <template-prefix> <template-args>
::= <decltype>
::= # empty ::= # empty
::= <substitution> */ ::= <substitution> */
...@@ -968,6 +969,12 @@ write_prefix (const tree node) ...@@ -968,6 +969,12 @@ write_prefix (const tree node)
MANGLE_TRACE_TREE ("prefix", node); MANGLE_TRACE_TREE ("prefix", node);
if (TREE_CODE (node) == DECLTYPE_TYPE)
{
write_type (node);
return;
}
if (find_substitution (node)) if (find_substitution (node))
return; return;
......
2011-08-01 Jason Merrill <jason@redhat.com> 2011-08-01 Jason Merrill <jason@redhat.com>
PR c++/49932
* g++.dg/abi/mangle49.C: New.
PR c++/49924 PR c++/49924
* g++.dg/cpp0x/constexpr-array4.C: New. * g++.dg/cpp0x/constexpr-array4.C: New.
......
// PR c++/49932
// { dg-options "-std=c++0x -fabi-version=0" }
template < typename T >
auto
f1( T x ) // ICE on here
-> typename decltype( x )::type {}
template < typename T >
typename decltype( T() )::type
f2( T x ) {} // ICE on here
struct S { typedef void type; };
void g()
{
f1( S() );
f2( S() );
}
// { dg-final { scan-assembler "_Z2f1I1SENDtfp_E4typeET_" } }
// { dg-final { scan-assembler "_Z2f2I1SENDTcvT__EE4typeES1_" } }
2011-08-01 Jason Merrill <jason@redhat.com>
PR c++/49932
* cp-demangle.c (d_prefix): Handle decltype.
* testsuite/demangle-expected: Test it.
2011-07-26 H.J. Lu <hongjiu.lu@intel.com> 2011-07-26 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/demangle-expected: Remove an extra line. * testsuite/demangle-expected: Remove an extra line.
......
...@@ -1280,6 +1280,7 @@ d_nested_name (struct d_info *di) ...@@ -1280,6 +1280,7 @@ d_nested_name (struct d_info *di)
/* <prefix> ::= <prefix> <unqualified-name> /* <prefix> ::= <prefix> <unqualified-name>
::= <template-prefix> <template-args> ::= <template-prefix> <template-args>
::= <template-param> ::= <template-param>
::= <decltype>
::= ::=
::= <substitution> ::= <substitution>
...@@ -1308,10 +1309,19 @@ d_prefix (struct d_info *di) ...@@ -1308,10 +1309,19 @@ d_prefix (struct d_info *di)
<template-param> here. */ <template-param> here. */
comb_type = DEMANGLE_COMPONENT_QUAL_NAME; comb_type = DEMANGLE_COMPONENT_QUAL_NAME;
if (IS_DIGIT (peek) if (peek == 'D')
{
char peek2 = d_peek_next_char (di);
if (peek2 == 'T' || peek2 == 't')
/* Decltype. */
dc = cplus_demangle_type (di);
else
/* Destructor name. */
dc = d_unqualified_name (di);
}
else if (IS_DIGIT (peek)
|| IS_LOWER (peek) || IS_LOWER (peek)
|| peek == 'C' || peek == 'C'
|| peek == 'D'
|| peek == 'U' || peek == 'U'
|| peek == 'L') || peek == 'L')
dc = d_unqualified_name (di); dc = d_unqualified_name (di);
......
...@@ -3901,6 +3901,10 @@ java resource java/util/iso4217.properties ...@@ -3901,6 +3901,10 @@ java resource java/util/iso4217.properties
--format=gnu-v3 --format=gnu-v3
_Z3addIidEDTplfp_fp0_ET_T0_ _Z3addIidEDTplfp_fp0_ET_T0_
decltype ({parm#1}+{parm#2}) add<int, double>(int, double) decltype ({parm#1}+{parm#2}) add<int, double>(int, double)
# decltype scope test
--format=gnu-v3
_Z1fI1SENDtfp_E4typeET_
decltype ({parm#1})::type f<S>(S)
# decltype/fn call test # decltype/fn call test
--format=gnu-v3 --format=gnu-v3
_Z4add3IidEDTclL_Z1gEfp_fp0_EET_T0_ _Z4add3IidEDTclL_Z1gEfp_fp0_EET_T0_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment