Skip to content

Instantly share code, notes, and snippets.

@RElesgoe
Created January 18, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RElesgoe/e39e39b136e27b2393618b8fee7f3866 to your computer and use it in GitHub Desktop.
Save RElesgoe/e39e39b136e27b2393618b8fee7f3866 to your computer and use it in GitHub Desktop.
// clang++ -std=c++11 -stdlib=libc++ main.cpp
/* clang --version
* clang version 3.8.0-2ubuntu3~trusty4 (tags/RELEASE_380/final)
*/
/* lsb_release -a
* No LSB modules are available.
* Distributor ID: Ubuntu
* Description: Ubuntu 14.04.5 LTS
* Release: 14.04
* Codename: trusty
*/
#include <cstddef>
#define elist_entry(ptr, type, member) ((type*)(((char*)ptr)-offsetof(type, member)))
typedef struct elist_struct {
struct elist_struct *next, *prev;
} t_elist;
typedef struct {
t_elist refs_link;
} t_rcm_regref;
int main()
{
char a[] = "Hello World";
char* b = a;
t_rcm_regref* c = elist_entry(b, t_rcm_regref, refs_link);
}
@RElesgoe
Copy link
Author

main.cpp:31:35: error: unexpected type name 't_rcm_regref': expected expression
main.cpp:31:49: error: use of undeclared identifier 'refs_link'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment