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

            Bug ID: 105707
           Summary: Bug will including file in a namespace
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adrien.grassein at gmail dot com
  Target Milestone: ---

Hi,

I encounter a bug while compile this short code with gcc-12.1.0:

#include <functional>
namespace something {
    #include <utility>
}

int main() {
    return 0;
}

Command line:

x86_64-linux-gnu-gcc-12 -Wall -Wextra  -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations  bug.cpp -o main

Output:

In file included from bug.cpp:3:
/tmp/usr/include/c++/12/utility:94:14: error: '__and_' was not declared in this
scope; did you mean 'std::__and_'?
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |              ^~~~~~
      |              std::__and_
In file included from /tmp/usr/include/c++/12/bits/move.h:57,
                 from /tmp/usr/include/c++/12/bits/stl_function.h:60,
                 from /tmp/usr/include/c++/12/functional:49,
                 from bug.cpp:1:
/tmp/usr/include/c++/12/type_traits:154:12: note: 'std::__and_' declared here
  154 |     struct __and_;
      |            ^~~~~~
/tmp/usr/include/c++/12/utility:94:21: error: 'is_nothrow_move_constructible'
was not declared in this scope; did you mean
'std::is_nothrow_move_constructible'?
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                     std::is_nothrow_move_constructible
/tmp/usr/include/c++/12/type_traits:1102:12: note:
'std::is_nothrow_move_constructible' declared here
 1102 |     struct is_nothrow_move_constructible
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/usr/include/c++/12/utility:94:54: error: expected primary-expression
before '>' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                      ^
/tmp/usr/include/c++/12/utility:94:55: error: expected primary-expression
before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                       ^
/tmp/usr/include/c++/12/utility:94:55: error: expected ')' before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |             ~                                         ^
      |                                                       )
/tmp/usr/include/c++/12/utility:94:55: error: expected ';' before ',' token
   94 |     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
      |                                                       ^
      |                                                       ;
/tmp/usr/include/c++/12/utility:103:15: error: 'add_const_t' does not name a
type
  103 |     constexpr add_const_t<_Tp>&
      |               ^~~~~~~~~~~


This is perfectly working when gcc-11 and previous version.
I reproduced this bug using the last gcc13 version (gcc-13-20220522)


x86_64-linux-gnu-gcc-12 -v
Using built-in specs.
COLLECT_GCC=/tmp/usr/bin/x86_64-linux-gnu-gcc-12
COLLECT_LTO_WRAPPER=/tmp/usr/bin/../lib/gcc/x86_64-linux-gnu/12/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ./configure -with-pkgversion='Ubuntu 11.2.0-19ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c++
--prefix=/usr --with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean
--enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (Ubuntu 11.2.0-19ubuntu1)

Thanks,

Reply via email to