1 // PR c++/26997
2 // { dg-do compile }
3 void * malloc (unsigned long size);
4 typedef struct { int a; } t;
5 
foo()6 void foo()
7 {
8   t *v3;
9   v3 = (t *)
10     malloc(
11 	   sizeof(t)
12 	   *
13            t->a // { dg-error "before '->' token" }
14 	   );
15 }
16 
17 class C {
18 public:
19   void operator[](int);
20 };
21 
bar(void)22 C bar (void)
23 {
24   (C ())(3); // { dg-error "invalid cast" }
25   return (C ());
26 }
27 
28 extern void baz (C,C);
29 
foo1(void)30 void foo1 (void)
31 {
32   baz ((C()), (C()));
33 }
34 
35 struct S {
36   void operator()(int);
37 };
38 
39 int *var;
foo2(void)40 void foo2 (void)
41 {
42   C ()[2];
43   (C ())[2];
44   (S ())(3); // { dg-error "invalid cast" }
45   (C())*var; // { dg-error "invalid cast" }
46   (C())+var;  // { dg-error "invalid cast" }
47   S()(3);
48   (S()(3));
49 }
50 
51