Is real image formed by a single optical element always inverted and virtual image always erect? Question:
Is real image always inverted and virtual image always erect with respect to the object? Is there any single optical device (a mirror, or a lens, or anything else) which could produce a real and erect image or a virtual and inverted image? Till now, I haven't encountered such a device. Does it mean this is not possible? Is there any fundamental law which prevents the existence of an optical device which could produce a real and erect image or a virtual and inverted image?
I know that we could produce a real and erect image by using two convex lenses by placing them one after the other, where the inverted image formed by the first lens acts as an object for the second lens which again inverts it to give a resultant erect image with respect to the original object. Here we get an erect image due to two inversions. This question is about a single device which could produce a real and erect image without any intermediate inversion steps.
Edit:
It was asked in the comments what is meant by a "single optical device". By this term, I meant that the device is made of a single piece of material of same refractive index throughout. So a combination of lenses or mirrors which may produce real and erect images do not count.
 A: A gradient index rod lens will form an erect or inverted image, depending on its length.  A SELFOC lens is usually designed to transfer an image from the flat surface on one end of a rod, to the flat surface at the other end of the rod.  A SELFOC lens is usually designed to produce an inverted image, but when made twice as long (that is, with pitch 1.0) it forms an erect image.  The ray paths for a single pixel on one surface go through the rod as shown below.  They come to an inverted focus in the middle of the rod, then back to an erect image at the other end of the rod.

This image is one frame from a video on the Stemmer Imaging website, though there are several companies who provide gradient index rod lenses.  This sort of device is sometimes called a "Contact Imaging Sensor", and would be one element of a "line scan bar".
Edit #1 Some other approaches might meet the uniform refractive index, single-element condition:


*

*Retroreflection: A ball lens with a refractive index of 2.0 and a highly reflective coating on its back half will return light to its source.  That means that an erect real image is formed from an erect source image.

*Fly's Eye lens:  A slab of glass or plastic with small lenses on both sides can form an erect image.  Each lens on one face of the device forms a small field-of-view erect real image via the corresponding lens on the opposite side of the slab.  The lenses and the slab thickness are designed to ensure that the imaging is precisely 1:1, and the images all add up.  This is the principle of the contact image sensors (line scan bars), and is a variation on the principle illustrated by @BarsMonster: just build an array of the rod lenses he described, and fuse them together to eliminate boundaries between the rods, leaving only lens bumps on the surfaces.  Of course this element can be cast in plastic.


I'm pretty sure two optical surfaces are required, when the refractive index is positive, because we can show that an single optical surface (reflective or positive-refractive) can only form an inverted real image.  HOWEVER, negative index materials, in principle, can do it with only a flat, parallel-faced slab. See "Negative refraction makes a perfect lens" by Pendry.

A: I can only think of multiple optical devices combined in a single entity in a way to not violate your restrictions of being single device. Ether double lenses merged into one, or prism/mirror merged with a lens, or first surface curved mirrors with multiple reflections, while all this still being made from 1 piece of glass. 

A: Correct me if I am wrong, by "single optical device" you meant the device should either converge or diverge or do nothing to the parallel rays. 
If we want to create a real image of a point light source, all the divergent light rays from the source must converge again to a point after passing through the stated device. In order to get an erect image, rays diverging from the point source, if present above central line, must also converge the above the central line. Consider a ray coming from the source and passing through the center. This ray must follow a V-Shaped path to get an image above the center line, which is impossible (because it won't be convergent anymore). I tried to depict my argument by a figure, it's not a very good drawing though.
A: From the mirror formula ;
$$\frac{1}{f} = \frac{1}{v} + \frac{1}{u}$$
magnification formula ;
$$ m =\frac{h_{image}}{h_{object}} = \frac{-v}{u}$$
and commonly used sign convention , it's easy to see that how it all works. An illustration as a hint is provided below for a special case.
Illustration:For a concave mirror when $u<f$:
As said , with cartesian sign conventions, we have
$f<0 , u<0$ and $ u<f$, we get ;
$1) v<0$ ( which means rays are not divergent and hence real )
$2) \frac{h_image}{h_object} < 0$ ( which means that image is inverted ).
It would be a good exercise if you verify all other cases yourself. Good Luck !
