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

            Bug ID: 113924
           Summary: worse diagnostic for invalid decltype since r10-5347
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

int m () = delete;

void
f (int i, int = decltype (m()){ })
{
}

void
f2 (int i, int = decltype(x){ })
{
}

used to say

/home/mpolacek/w.C:4:29: error: use of deleted function ‘int m()’
    4 | f (int i, int = decltype (m()){ })
      |                             ^
/home/mpolacek/w.C:1:5: note: declared here
    1 | int m () = delete;
      |     ^
/home/mpolacek/w.C:4:29: error: use of deleted function ‘int m()’
    4 | f (int i, int = decltype (m()){ })
      |                             ^
/home/mpolacek/w.C:1:5: note: declared here
    1 | int m () = delete;
      |     ^
/home/mpolacek/w.C:9:27: error: ‘x’ was not declared in this scope
    9 | f2 (int i, int = decltype(x){ })
      |                           ^
/home/mpolacek/w.C:9:27: error: ‘x’ was not declared in this scope

which still duplicated the errors, but now we say:

/home/mpolacek/w.C:4:29: error: use of deleted function ‘int m()’
    4 | f (int i, int = decltype (m()){ })
      |                             ^
/home/mpolacek/w.C:1:5: note: declared here
    1 | int m () = delete;
      |     ^
/home/mpolacek/w.C:4:29: error: use of deleted function ‘int m()’
    4 | f (int i, int = decltype (m()){ })
      |                             ^
/home/mpolacek/w.C:1:5: note: declared here
    1 | int m () = delete;
      |     ^
/home/mpolacek/w.C:4:17: error: expected primary-expression before ‘decltype’
    4 | f (int i, int = decltype (m()){ })
      |                 ^~~~~~~~~~~~~
/home/mpolacek/w.C:4:17: error: expected ‘,’ or ‘...’ before ‘decltype’
/home/mpolacek/w.C:4:34: error: expected unqualified-id before ‘)’ token
    4 | f (int i, int = decltype (m()){ })
      |                                  ^
/home/mpolacek/w.C:9:27: error: ‘x’ was not declared in this scope
    9 | f2 (int i, int = decltype(x){ })
      |                           ^
/home/mpolacek/w.C:9:27: error: ‘x’ was not declared in this scope
/home/mpolacek/w.C:9:18: error: expected primary-expression before ‘decltype’
    9 | f2 (int i, int = decltype(x){ })
      |                  ^~~~~~~~~~
/home/mpolacek/w.C:9:18: error: expected ‘,’ or ‘...’ before ‘decltype’
/home/mpolacek/w.C:9:32: error: expected unqualified-id before ‘)’ token
    9 | f2 (int i, int = decltype(x){ })
      |                                ^

and that's even worse.

Reply via email to