title: C++ Declaration and instantiation of scoped variable with curly braces instead of assignment operator
body: <p>I am watching Bjarne Stroustrup's Keynote on C++11 Style (<a href="http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Keynote-Bjarne-Stroustrup-Cpp11-Style" rel="noreferrer">link</a>) (00:35:30) and am having troubles understanding the following (code copied from the slide):</p>
  
  <pre><code>void f(int n, int x)
  {
        Gadget g {n};
        // ...
        if (x&lt;100) throw std::run_time_error{"Weird!"};
        if (x&lt;200) return;
        // ...
  }
  </code></pre>
  
  <p>I tried compiling this code using a struct as well as an object but in both cases the compiler tells me that it is  expecting a ';' at the end of the declaration of <code>Gadget g</code> and won't compile.</p>
  
  <p>My questions therefore are:</p>
  
  <ul>
  <li>Am I correct to assume that <code>g</code> is being instantiated?</li>
  <li>What type of object must <code>Gadget</code> be for this code to compile?</li>
  <li>What concept is at work on this line: <code>Gadget g {n};</code>? i.e. What are the curly braces after the declaration?</li>
  <li>(probably too broad, but) Why would the compiler not recognize the curly braces as valid syntax?</li>
  </ul>