summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/temps6.C
blob: 19a12d740361141aaf99978a733f311e535d8f12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// { dg-do run  }
// GROUPS passed temps
// Date: Tue, 22 Mar 94 12:46:28 +0100
// From: dak@pool.informatik.rwth-aachen.de
// Message-Id: <9403221146.AA07815@messua>
// Subject: Bad code for pointer to member use as reference in g++ 2.5.8

#include <stdio.h>
struct str {
  int i;
} xxx = {0};

int& test(str *arg1, int str::*arg2)
{
  return (arg1->*arg2);
}

int main()
{
  test(&xxx, &str::i) = 5;
  if (xxx.i == 0)
    { printf ("FAIL\n"); return 1; }
  else
    printf ("PASS\n");
}