[code]
void test(D)( const D data ) if( is(D: shared(char[]) ) ) { }

void main() {
        char[] text = new char[4];
        text[0] = 'a'; text[1] = 'b'; text[2] = 'c'; text[3] = 'd';
        
        auto t = cast( shared(const(char[])) )text[1..2];

        test( t );
}

[/code]

Error Message:
template main.test cannot deduce function from argument types !()(shared(const(char[])))

`t` is already shared(const(char[])), and `test` is expecting const shared(char[]). Aren't they already same?

--

Together with this question, I want to ask whether there is a way to check only being `shared`, only being `const`, or only being `char[]` of a template variable (D of `test` in this case)?

Reply via email to