What's the -complete- list of kinds of automatic type conversions a C++ compiler will do for a function argument?
<p>Given a C++ function f(X x) where x is a variable of type X, and a variable y of type Y, what are all the automatic/implicit conversions the C++ compiler will perform on y so that the statement "f(y);" is legal code (no errors, no warnings)?</p>

<p>For example:</p>

<p>Pass Derived&amp; to function taking Base&amp; - ok
Pass Base&amp; to function Derived&amp; - not ok without a cast
Pass int to function taking long - ok, creates a temporary long
Pass int&amp; to function taking long&amp; - NOT ok, taking reference to temporary</p>

<p>Note how the built-in types have some quirks compared to classes:  a Derived can be passed to function taking a Base (although it gets sliced), and an int can be passed to function taking a long, but you cannot pass an int&amp; to a function taking a long&amp;!!</p>

<p>What's the complete list of cases that are always "ok" (don't need to use any cast to do it)?</p>

<p>What it's for:  I have a C++ script-binding library that lets you bind your C++ code and it will call C++ functions at runtime based on script expressions.  Since expressions are evaluated at runtime, all the legal combinations of source types and function argument types that might need to be used in an expression have to be anticipated ahead of time and precompiled in the library so that they'll be usable at runtime.  If I miss a legal combination, some reasonable expressions won't work in runtime expressions; if I accidently generate a combination that isn't legal C++, my library just won't compile.</p>

<p>Edit (narrowing the question):</p>

<p>Thanks, all of your answers are actually pretty helpful.  I knew the answer was complicated, but it sounds like I've only seen the tip of the iceberg.</p>

<p>Let me rephrase the question a little then to limit its scope then:
I will let the user specify a list of "BaseClasses" and a list of "UserDefinedConversions".  For Bases, I'll generate everything including reference and pointer conversions.  But what cases (const/reference/pointer) can I safely do from the UserDefined Conversions list?  (The user will give bare types, I will decorate with *, &amp;, const, etc. in the template.)</p>
