What happens when you plug a BSDF into a value socket?

What happens when you plug a BSDF (shader) socket into a value (float/color/vector) socket, or vice-versa? Obviously there is no way to convert a function to a value, so what does blender do?

From some simple testing it seems that it converts the BSDF to 0.5, but sparked by the discussion in comments on this answer I would like a more definitive answer.

1 Answer

It doesn't do anything.

Cycles will use the value specified for that socket and ignore the invalid connection:

This example uses a color input, but the same applies for value inputs.

As you can see, the render result is the same with or without the diffuse node in the above setup.

For some explanation on why cycles works like this, see Convert cycles closure (shader) output to colors?
For a workaround, see Is it possible to use the output of a Renderlayer in the material nodes of another RenderLayer?