From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B1180385BF9D; Wed, 19 May 2021 22:56:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1180385BF9D From: "webrown.cpp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100687] New: [modules, concepts] imported concept gives different result Date: Wed, 19 May 2021 22:56:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: webrown.cpp at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 22:56:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100687 Bug ID: 100687 Summary: [modules, concepts] imported concept gives different result Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: webrown.cpp at gmail dot com Target Milestone: --- Using recent trunk [g++-HEAD (Homebrew GCC HEAD-5380e3c) 12.0.0 20210513], compiling with significant flags -std=3Dc++23 -fmodules-ts -c. I have two source files, as follows: ////////////////////// export module bug_a; template< class T > inline constexpr bool probe =3D false; // template< class R, class C > inline constexpr bool probe =3D true; export template< class T > concept mbr_ptr =3D probe; struct S { int f( ); }; using mf_t =3D decltype( &S::f ); static_assert( mbr_ptr< mf_t > ); ////////////////////// This bug_a module compiles successfully. In particular, the static_assert passes. ////////////////////// export module bug_b; import bug_a; struct S { int f( ); }; using mf_t =3D decltype( &S::f ); static_assert( mbr_ptr< mf_t > ); ////////////////////// This bug_b module does not compile. The diagnostics are reproduced below, including the somewhat mysterious lone apostrophe: bug_b.cc:8:16: error: static assertion failed 8 | static_assert( mbr_ptr< mf_t > ); | ^~~~~~~~~~~~~~~ bug_b.cc:8:16: note: constraints not satisfied ' bug_a.cc:12: confused by earlier errors, bailing out Please note that the static_assert and supporting declarations in module bu= g_a are identical to those in module bug_a, yet one compiles while the other do= es not. Thus we seem to have two problems: (1) the lone apostrophe amongst the diagnostics, and (2) the inconsistent evaluation of identical expressions. Finally, please note that if I use a class template (instead of the variable template) in module bug_a, both modules' static_asserts now compile without complaint: ////////////////////// template< class T > struct probe { static constexpr bool value =3D false; }; // template< class R, class C > struct probe { static constexpr bool value =3D true; }; export template< class T > concept mbr_ptr =3D probe::value; //////////////////////=