[Bug 1705410] Re: _Generic selector didn't select correct expression.

wierton 1705410 at bugs.launchpad.net
Thu Jul 20 09:07:45 UTC 2017


** Description changed:

  $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;
+  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);
+   _Generic(a, A *:a->dt->bt, B *:a->bt);
+                                      ^

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

Title:
  _Generic selector didn't select correct expression.

Status in gcc-5 package in Ubuntu:
  New

Bug description:
  $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);
                                       ^

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



More information about the foundations-bugs mailing list