History

Make fn designators in ?: decay to ptrs

This _Generic((__typeof(1?f:f)*){0}, void (**)(void): (void)0); should compile like it does in gcc and clang.

Petr Skocik committed 7 years ago

Commit 49dfb571 parent 3058d412 files · +29 −5Browse files

Showing the changes to tests (1 of 2 files). Show all

Unified · Split

tests/tests2/33_ternary_op.c+21−0
@@ -1,6 +1,27 @@
1#include <stdio.h>1#include <stdio.h>
2#include <assert.h>2#include <assert.h>
3 3
4char arr[1];
5static void f (void){}
6void (*fp)(void) = f;
7void call_fp()
8{
9 (fp?f:f)();
10 (fp?fp:fp)();
11 (fp?fp:&f)();
12 (fp?&f:fp)();
13 (fp?&f:&f)();
14 _Generic(0?arr:arr, char*: (void)0);
15 _Generic(0?&arr[0]:arr, char*: (void)0);
16 _Generic(0?arr:&arr[0], char*: (void)0);
17 _Generic(1?arr:arr, char*: (void)0);
18 _Generic(1?&arr[0]:arr, char*: (void)0);
19 _Generic(1?arr:&arr[0], char*: (void)0);
20 _Generic((__typeof(1?f:f)*){0}, void (**)(void): (void)0);
21 (fp?&f:f)();
22 (fp?f:&f)();
23}
24
4int main()25int main()
5{26{
6 int Count;27 int Count;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t