title: Static structure initialization with tags in C++
body: <p>I've searched stackoverflow for an answer but I cannot get something relevant.</p>
  
  <p>I'm trying to initialize a static structure instance with initial values by specifying their tags, but I get an error at compilation time:</p>
  
  <p><code>src/version.cpp:10: error: expected primary-expression before ‘.’ token</code></p>
  
  <p>Here's the code:</p>
  
  <pre><code>// h
  typedef struct
  {
      int lots_of_ints;
      /* ... lots of other members */
      const char *build_date;
      const char *build_version;
  } infos;
  </code></pre>
  
  <p>And the faulty code: </p>
  
  <pre><code>// C
  
  static const char *version_date = VERSION_DATE;
  static const char *version_rev  = VERSION_REVISION;
  
  static const infos s_infos =
  {
     .build_date    = version_date, // why is this wrong? it works in C!
     .build_version = version_rev
  };
  
  const infos *get_info()
  {
      return &amp;s_infos;
  }
  </code></pre>
  
  <p>So the basic idea is to bypass the "other members" initialization and only set the relevant <code>build_date</code> and <code>build_version</code> values.
  This used to work in C, but I can't figure out why it won't work in C++.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>edit</strong>:</p>
  
  <p>I realize this code looks like simple C, and it actually is. The whole project is in C++ so I have to use C++ file extensions to prevent the makefile dependency mess ( <code>%.o: %.cpp</code> )</p>