diff mbox

[c++-concepts] Fix assertion failure with cp_maybe_constrained_type_specifier

Message ID 53A00249.6050003@maniacsvault.net
State New
Headers show

Commit Message

Braden Obrzut June 17, 2014, 8:54 a.m. UTC
cp_maybe_constrained_type_specifier asserted that the decl passed in 
would be of type OVERLOAD, however a clean build of the compiler was 
broken since it could also be a BASELINK.  I'm not entirely sure when 
this is the case, except that it seems to happen with class member 
templates as it also caused a test case in my next patch to fail.  The 
solution is to check for a BASELINK and extract the functions from it.

The possibility of decl being a BASELINK is asserted near the call in 
cp_parser_template_id (cp_maybe_partial_concept_id just calls the 
function in question at this time).

2014-06-17  Braden Obrzut  <admin@maniacsvault.net>
     * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): Fix assertion
     failure if baselink was passed in as decl.

Comments

Andrew Sutton June 24, 2014, 11:40 a.m. UTC | #1
Braden,

Did you have a specific test case that causes this breakage? I have a
feeling that if we're missing base-link nodes in one place, we'll miss
them in others too.

Andrew


On Tue, Jun 17, 2014 at 4:54 AM, Braden Obrzut <admin@maniacsvault.net> wrote:
> cp_maybe_constrained_type_specifier asserted that the decl passed in would
> be of type OVERLOAD, however a clean build of the compiler was broken since
> it could also be a BASELINK.  I'm not entirely sure when this is the case,
> except that it seems to happen with class member templates as it also caused
> a test case in my next patch to fail.  The solution is to check for a
> BASELINK and extract the functions from it.
>
> The possibility of decl being a BASELINK is asserted near the call in
> cp_parser_template_id (cp_maybe_partial_concept_id just calls the function
> in question at this time).
>
> 2014-06-17  Braden Obrzut  <admin@maniacsvault.net>
>     * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): Fix assertion
>     failure if baselink was passed in as decl.
>
diff mbox

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1eaf863..40d1d63 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15175,6 +15175,9 @@  cp_parser_allows_constrained_type_specifier (cp_parser *parser)
 static tree
 cp_maybe_constrained_type_specifier (cp_parser *parser, tree decl, tree args)
 {
+  if (BASELINK_P (decl))
+    decl = BASELINK_FUNCTIONS (decl);
+
   gcc_assert (TREE_CODE (decl) == OVERLOAD);
   gcc_assert (args ? TREE_CODE (args) == TREE_VEC : true);