Warum entfernt decltype const aus Rückgabetypen für eingebaute Typen?

Generell,decltype erhält die Konstanz:

const int ci = 0;
decltype(ci)  x;         // x is const int
x = 5;                   // error--x is const

class Gadget{}:

const Gadget makeCG();         // factory

decltype(makeCG()) y1, y2;     // y1 and y2 are const Gadgets
y1 = y2;                       // error--y1 is const

Aber fürconst Rückgabetypen, die grundlegende Typen zurückgeben,decltype scheint zu werfenconst Weg:

const int makeCI();            // factory

decltype(makeCI()) z;          // z is NOT const
z = 5;                         // okay

Warum tutdecltype Konstanz in diesem Fall verwerfen? Ich meine die Frage auf zwei Arten:

Welcher Teil der Norm legt dieses Verhalten fest?Was ist die Motivation, das Verhalten so zu spezifizieren?

Vielen Dank.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage