🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by James Clark Fri, 18 Aug 1989 12:19
friend bug and fix
#359
Author: James Clark
Date: Fri, 18 Aug 1989 12:19
55 lines
1718 bytes
g++ 1.35.1- incorrectly accepts this:

class A {
  int n;
 public:
  A();
  friend int foo(double);
  friend int foo(char);
};

int foo(A a)
{
  return a.n;
}

I think the fix for this is:

*** cplus-init.c.distrib        Fri Aug 18 13:01:19 1989
--- cplus-init.c        Fri Aug 18 13:02:00 1989
***************
*** 1703,1717 ****
  add_friend (type, decl)
       tree type, decl;
  {
    tree typedecl = TYPE_NAME (type);
    tree list = DECL_FRIENDLIST (typedecl);
    tree name = DECL_ORIGINAL_NAME (decl);
    tree ctype = TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
!     ? TYPE_METHOD_BASETYPE (TREE_TYPE (decl)) : NULL_TREE;

    while (list)
      {
        if (name == TREE_PURPOSE (list))
        {
          tree friends = TREE_VALUE (list);
          while (friends)
--- 1703,1717 ----
  add_friend (type, decl)
       tree type, decl;
  {
    tree typedecl = TYPE_NAME (type);
    tree list = DECL_FRIENDLIST (typedecl);
    tree name = DECL_ORIGINAL_NAME (decl);
    tree ctype = TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
!     ? TYPE_METHOD_BASETYPE (TREE_TYPE (decl)) : error_mark_node;

    while (list)
      {
        if (name == TREE_PURPOSE (list))
        {
          tree friends = TREE_VALUE (list);
          while (friends)

James Clark
jjc@jclark.uucp
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads