OpenGL sampler2D as argument into subroutine method causes error

I have a subroutine method in GLSL fragment shader which should output pixel based on sampler2D as input argument.The program fails to compile with this setup.However the method works fine as long as I output just a color without texure2D() calculation. Is it possible that sampler2D can’t be passed as parameter.I am working with OpenGL 4.2,GLSL 420
Here is the code:


#version 420
subroutine vec4 RenderPass(sampler2D tex,vec2 uvsIn);
subroutine uniform RenderPass renderTechnique;
layout(binding=0)  uniform sampler2D colorMap;
smooth in vec2 uvsOut; 
........ there rest of stuff
subroutine( RenderPass )
vec4 copyPass(sampler2D tex,vec2 uvsIn)
{ 
   return texture2D(tex,uvsIn);  ////this however works ok : return vec4(1,0,0,1);
}

void main()
{    
  outputColor = renderTechnique(colorMap,uvsOut);
}