https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124382

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Everything in a single testcase:
#include <meta>

template <typename>
void foo (int a);

template <typename>
struct A {
  friend void foo <int> (int b);
};

constexpr auto a = sizeof (A <int>);

template <typename>
void bar (int a);

struct B {
  friend void bar <int> (int b);
};

void baz (int a);

template <typename>
struct C {
  friend void baz (int b);
};

constexpr auto c = sizeof (C <int>);

template <typename>
struct D {
  static void qux (int a);
};

template <typename>
struct E {
  friend void D <int>::qux (int b);
};

constexpr auto e = sizeof (E <int>);

static_assert (!has_identifier (parameters_of (^^foo <int>)[0]));
static_assert (!has_identifier (parameters_of (^^bar <int>)[0]));
static_assert (!has_identifier (parameters_of (^^baz)[0]));
static_assert (!has_identifier (parameters_of (^^D <int>::qux)[0]));

The bar case is marked MULTIPLE_NAMES_PARM_P in:
#0  merge_decl_arguments (newdecl=<function_decl 0x7fffe62dc000 bar>,
olddecl=<function_decl 0x7fffe62dc100 bar>, new_defines_function=false,
types_match=true, extern_alias=false)
    at ../../gcc/cp/decl.cc:1852
#1  0x000000000054a2ae in duplicate_decls (newdecl=<function_decl
0x7fffe62dc000 bar>, olddecl=<function_decl 0x7fffe62dc100 bar>, hiding=true,
was_hidden=false)
    at ../../gcc/cp/decl.cc:3157
#2  0x00000000007ad20f in register_specialization (spec=<function_decl
0x7fffe62dc000 bar>, tmpl=<template_decl 0x7fffe62d2e58 bar>, args=<tree_vec
0x7fffe62da700>, is_friend=true,
    hash=0) at ../../gcc/cp/pt.cc:1660
#3  0x00000000007b4400 in check_explicit_specialization
(declarator=<template_id_expr 0x7fffe62d8d70>, decl=<function_decl
0x7fffe62dc000 bar>, template_count=0, flags=4,
    attrlist=<tree 0x0>) at ../../gcc/cp/pt.cc:3362
#4  0x00000000005ef105 in do_friend (scope=<tree 0x0>,
declarator=<identifier_node 0x7fffe8c25480 bar>, decl=<function_decl
0x7fffe62dc000 bar>, flags=NO_SPECIAL,
    funcdef_flag=false) at ../../gcc/cp/friend.cc:675
and the baz case in:
#0  merge_decl_arguments (newdecl=<function_decl 0x7fffe62dc400 baz>,
olddecl=<function_decl 0x7fffe62dc200 baz>, new_defines_function=false,
types_match=true, extern_alias=false)
    at ../../gcc/cp/decl.cc:1852
#1  0x000000000054a2ae in duplicate_decls (newdecl=<function_decl
0x7fffe62dc400 baz>, olddecl=<function_decl 0x7fffe62dc200 baz>, hiding=true,
was_hidden=false)
    at ../../gcc/cp/decl.cc:3157
#2  0x00000000006dba94 in pushdecl (decl=<function_decl 0x7fffe62dc400 baz>,
hiding=true) at ../../gcc/cp/name-lookup.cc:4074
#3  0x00000000006e08a4 in do_pushdecl_with_scope (x=<function_decl
0x7fffe62dc400 baz>, level=0x7fffe980d708, hiding=true) at
../../gcc/cp/name-lookup.cc:5309
#4  0x00000000006e6b26 in pushdecl_namespace_level (decl=<function_decl
0x7fffe62dc400 baz>, hiding=true) at ../../gcc/cp/name-lookup.cc:6786
#5  0x00000000007db0ad in tsubst_friend_function (decl=<function_decl
0x7fffe62dc300 baz>, args=<tree_vec 0x7fffe62da800>) at
../../gcc/cp/pt.cc:11879
#6  0x00000000007e2d62 in instantiate_class_template (type=<record_type
0x7fffe62db690 C>) at ../../gcc/cp/pt.cc:13198
#7  0x00000000009177c5 in complete_type (type=<record_type 0x7fffe62db690 C>)
at ../../gcc/cp/typeck.cc:138

The foo case goes through tsubst_friend_function too (which is presumably where
it should be diagnosed), but no idea
where exactly we should perform the argument name merging.

Reply via email to