title: Duplicate CV qualifiers
body: <p>I have a simple piece of code:</p>
  
  <pre><code>const const int a = 10;
  </code></pre>
  
  <p>It fails to compile with <strong>gcc</strong>:</p>
  
  <pre><code>error: duplicate 'const'
  </code></pre>
  
  <p>However <strong>clang</strong> compiles it with a warning:</p>
  
  <pre><code>warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
  </code></pre>
  
  <p>Microsoft compiler also generates a warning.</p>
  
  <p>Also situation with <code>volatile</code> qualifier is the same.</p>
  
  <p>From the [dcl.type] (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4713.pdf" rel="nofollow noreferrer">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4713.pdf</a>):</p>
  
  <blockquote>
    <p>As a general rule, at most one defining-type-specifier is allowed in the complete decl-specifier-seq of a declaration or in a defining-type-specifier-seq, and at most one type-specifier is allowed in a type-specifier-seq.
    The only exceptions to this rule are the following:</p>
    
    <p>(2.1)
        const can be combined with any type specifier except itself.</p>
    
    <p>(2.2)
        volatile can be combined with any type specifier except itself.</p>
    
    <p>(2.3)
        signed or unsigned can be combined with char, long, short, or int.</p>
    
    <p>(2.4)
        short or long can be combined with int.</p>
    
    <p>(2.5)
        long can be combined with double.</p>
    
    <p>(2.6)
        long can be combined with long.</p>
  </blockquote>
  
  <p>So I don't quite understand what does "as a general rule" means. Is this formally valid or not?</p>
  
  <p>Also I found the related issue <a href="https://stackoverflow.com/questions/5781222/duplicate-const-qualifier-allowed-in-c-but-not-in-c">Duplicate const qualifier allowed in C but not in C++?</a>, but there discussion is mainly about c and c++ differences.</p>