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

            Bug ID: 92040
           Summary: Type requirements don't appear to work when a type
                    doesn't exist.
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Created attachment 47011
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47011&action=edit
Requested file

# GCC version

g++ (GCC) 10.0.0 20191009 (experimental)

# System type

Ubuntu on WSL

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

# GCC built with

export CC=/usr/bin/clang-9
export CXX=/usr/bin/clang++-9
export CFLAGS='-w -O3 -DNDEBUG -g0 -fdiagnostics-color=always -fuse-ld=lld'
export CXXFLAGS='-w -O3 -DNDEBUG -g0 -fdiagnostics-color=always -fuse-ld=lld'
export LDFLAGS='-fuse-ld=lld'

../gcc/configure --enable-languages=c,c++      \
                 --disable-bootstrap           \
                 --disable-libada              \
                 --disable-libgomp             \
                 --disable-libquadmath         \
                 --disable-libquadmath-support \
                 --disable-multilib            \
                 --disable-nls                 \
                 --disable-werror

make -j6
sudo make install-strip -j6

# Minimal repro

```cpp
template<typename T>
constexpr void example()
{
    constexpr auto result = requires { typename T::value_type; };
    static_assert(not result);
}

int main()
{
   struct s{};
   example<s>();
}
```

Built using: /usr/local/bin/g++ -std=c++2a test.cpp

# Diagnostic

```
test.cpp: In instantiation of 'constexpr void example() [with T = main()::s]':
test.cpp:11:15:   required from here
test.cpp:4:49: error: no type named 'value_type' in 'struct main()::s'
    4 |     constexpr auto result = requires { typename T::value_type; };
      |
```

Reply via email to