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

            Bug ID: 115339
           Summary: Missing -Wpedantic warning for a declarative
                    nested-name-specifier with a decltype-specifier.
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: email at miropalmu dot cc
  Target Milestone: ---

Following compiles on a GCC 15.0.0 20240604 without warnings with flags
-std=c++26 -Wall -Wextra -Wpedantic (https://godbolt.org/z/6fdbo9YcW):

```
struct X {
    struct a;
};
auto x = X{};
struct decltype(x)::a{};
```

However it should be ill-formed or at least give warning with -Wpedantic,
as [expr.prim.id.general] states (https://eel.is/c++draft/expr.prim.id#qual-2):

> A declarative nested-name-specifier shall not have a decltype-specifier.

`decltype(x)` is declarative nested-name-specifier as it is part of
class-head-name.

Reply via email to