From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7945D3858D28; Wed, 25 Jan 2023 09:27:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7945D3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674638859; bh=cIc/qDzDeWLvQZMSwlGpuBnzsTHWND5RvNBKOl1CuQc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NebN9049303STLCVI91jVnfuHZ3LV0GhoBT9acWcfKjixda8eOCYj58qAUm+Ms21j eWpnAkjCS7+ArMxykbA0CRSFtS3CFsozWHypWSGsgP6aCzXUeC9n2G3tNLgi1JUyiW y9t3Su9TQREJVlt4RY0gzeqjqnETkjwr67Tc6Wqc= From: "coyorkdow at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjKysvODc1MTJdIEVycm9yOiB0aGUgdHlwZSDigJhjb25z?= =?UTF-8?B?dCBhdXRv4oCZIG9mIOKAmGNvbnN0ZXhwcuKAmSB2YXJpYWJsZSBpcyBub3Qg?= =?UTF-8?B?bGl0ZXJhbA==?= Date: Wed, 25 Jan 2023 09:27:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 8.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: coyorkdow at outlook dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D87512 --- Comment #5 from Guo Youtao --- This bug can still be triggered in gcc-11 and gcc-12. Here are the codes (the preprocessed file is attached) ``` #include #include template constexpr auto is_pointer_v =3D std::is_pointer::value; template auto Wrap1(int) -> std::integral_constant().operator->())>>; template auto Wrap1(...) -> std::is_pointer; int main() { static_assert(!is_pointer_v>); // this line can comp= ile static_assert(decltype(Wrap1>(0))::value); // error return 0; } ``` The err msgs ``` % g++-11 a.cc -save-temps a.cc: In instantiation of 'constexpr const auto is_pointer_v': a.cc:8:49: required by substitution of 'template > std::integral_constant().operator->())> > Wrap1(int) [with Tp = =3D std::unique_ptr; decltype (& Tp::operator*)* =3D = ]' a.cc:15:53: required from here a.cc:5:16: error: the type 'const auto' of 'constexpr' variable 'is_pointer_v' is not literal 5 | constexpr auto is_pointer_v =3D std::is_pointer::value; | ^~~~~~~~~~~~ a.cc:5:16: error: 'const auto is_pointer_v' has incomplete type a.cc: In function 'int main()': a.cc:15:59: error: static assertion failed 15 | static_assert(decltype(Wrap1>(0))::value); // this line incurs error | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ ``` GCC version: ``` % gcc-11 -v Using built-in specs. COLLECT_GCC=3Dgcc-11 COLLECT_LTO_WRAPPER=3D/usr/local/Cellar/gcc/11.3.0_2/bin/../libexec/gcc/x86= _64-apple-darwin21/11/lto-wrapper Target: x86_64-apple-darwin21 Configured with: ../configure --prefix=3D/usr/local/opt/gcc --libdir=3D/usr/local/opt/gcc/lib/gcc/11 --disable-nls --enable-checking=3D= release --with-gcc-major-version-only --enable-languages=3Dc,c++,objc,obj-c++,fortr= an,d --program-suffix=3D-11 --with-gmp=3D/usr/local/opt/gmp --with-mpfr=3D/usr/local/opt/mpfr --with-mpc=3D/usr/local/opt/libmpc --with-isl=3D/usr/local/opt/isl --with-zstd=3D/usr/local/opt/zstd --with-pkgversion=3D'Homebrew GCC 11.3.0_2' --with-bugurl=3Dhttps://github.com/Homebrew/homebrew-core/issues --enable-libphobos --build=3Dx86_64-apple-darwin21 --with-system-zlib --with-sysroot=3D/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.3.0 (Homebrew GCC 11.3.0_2) ``` If remove the parameter `decltype(&Tp::operator*)* =3D nullptr` then codes = can be compiled. The error also happens in gcc-12.=