https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70352

            Bug ID: 70352
           Summary: [C++11] auto cannot be used in the type-id of a
                    new-expression
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com
  Target Milestone: ---

The sample code below should be compiled successfully but it causes a
compilation error.

============== sample code ==============
int main()
{
    auto p = new (auto)(42);
}
============== sample code ==============

cf. http://melpon.org/wandbox/permlink/eSIE4OPkAubCIO5z


The C++11 standard 7.1.6.4 [dcl.spec.auto] p.4 says,

The auto type-specifier can also be used in declaring a variable in ...,
in the type-specifier-seq in the new-type-id or type-id of a new-expression
(5.3.4),
...


The 'auto' type-specifier above is a type-id, so it is well-formed.

Reply via email to