Inherit from const type passed as template parameter : <p>The following code is not valid:</p>

<pre><code>struct base {
};

struct inherit : const base {
};
</code></pre>

<p>You cannot inherit from a <code>const</code> type.</p>

<p>Does the situation change when templates are involved? In other words, is this code valid:</p>

<pre><code>struct base {
};

template&lt;typename T&gt;
struct inherit : T {
    using T::T;
};

int main() {
    inherit&lt;base const&gt;{};
}
</code></pre>

<p>gcc is says it is fine, but clang reports </p>

<pre><code>&lt;source&gt;:6:2: error: 'const base' is not a direct base of 'inherit&lt;const base&gt;', cannot inherit constructors

        using T::T;

        ^        ~

&lt;source&gt;:10:2: note: in instantiation of template class 'inherit&lt;const base&gt;' requested here

        inherit&lt;base const&gt;{};

        ^

1 error generated.

Compiler returned: 1
</code></pre>

<p>To make clang happy, I need to do something like this:</p>

<pre><code>template&lt;typename T&gt;
struct inherit : T {
    using U = std::remove_const_t&lt;T&gt;;
    using U::U;
};
</code></pre>

<p>Which version is correct? Or are neither of them correct and I need to inherit from <code>std::remove_const_t&lt;T&gt;</code>?</p>
