title: C++ attributes namespace?
body: <p><a href="https://en.cppreference.com/w/cpp/language/attributes" rel="nofollow noreferrer">Cppreference</a> says the <em>attribute-list</em> inside the double brackets <code>[[</code> <code>]]</code> can be identifiers.</p>
  
  <p>Say I have a variable named <code>noreturn</code> in my C++ program (so it is an identifier of a variable). Does it interfere with the interpretation of the <code>[[noreturn]]</code> attribute? My thinking is, if identifiers in the <em>attribute-list</em> share the same namespace as the ordinary identifiers (in this example, they both stay in the global namespace), the compiler might interpret it as an identifier to a variable, then it won't recognize it as a valid C++ attribute.</p>
  
  <p>Example:</p>
  
  <pre><code>int noreturn = 1;
  [[ noreturn ]] void f() {
       throw "error";
  }
  </code></pre>
  
  <p>The usage of <code>[[noreturn]]</code> is given here: <a href="https://en.cppreference.com/w/cpp/language/attributes/noreturn" rel="nofollow noreferrer">https://en.cppreference.com/w/cpp/language/attributes/noreturn</a></p>
  
  <p><strong>Update</strong>: for clarification, I knew in C (not C++) there are 4 "predefined" namespaces: for labels, for tags, for struct/union members, and for ordinary identifiers. But it is defined for C (C11 6.2.3) so I wondered if C++11 has an "attribute" namespace added to them. According to the accepted answer, in C++ the rules are expressed differently but the analogy stands.</p>