Public bug reported:

$gcc -v
....
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

$cat a.c
struct B;

typedef struct B { int bt; } B;

typedef struct A { B *dt; } A;


int main() {
        A *a = &(A){ &(B){0} };
        _Generic(a, A *:a->dt->bt, B *:a->bt); // report error here but it 
shouldn't
        _Generic(a, A *:a->dt->bt); // didn't report any error as expected
        return 0;
}

$gcc -std=c11 a.c
a.c: In function ‘main’:
a.c:10:34: error: ‘A {aka struct A}’ has no member named ‘bt’
  _Generic(a, A *:a->dt->bt, B *:a->bt);

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1705410

Title:
  _Generic selector didn't select correct expression.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1705410/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to