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

            Bug ID: 65552
           Summary: [c++-concepts] Constraint checking regression for
                    concepts with multiple type requirements
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net

I built the latest revision of the gcc c++-concepts branch (r221648) last night
and encountered a regression in constraint checking for concepts that specify
multiple type requirements.

Constraint checking only fails if a requires expression specifies multiple type
requirements.  Placing the type constraints in distinct requires expressions
suffices to work around the problem.

$ cat t.cpp
template<typename T>
concept bool Concept() {
    return requires () {
               typename T::member_type1;
#if WORKAROUND
           }
        && requires () {
#endif
               typename T::member_type2;
           };
}
struct model {
    using member_type1 = int;
    using member_type2 = int;
};
template<Concept C>
struct S {};
S<model> s;

$ svn info   # From my local svn gcc repo.
Path: .
URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 221648
Node Kind: directory
Schedule: normal
Last Changed Author: asutton
Last Changed Rev: 221633
Last Changed Date: 2015-03-24 09:36:27 -0400 (Tue, 24 Mar 2015)

$ g++ -c -std=c++1z t.cpp
t.cpp:18:8: error: template constraint failure
 S<model> s;
        ^
t.cpp:18:8: note:   constraints not satisfied
t.cpp:18:8: note:   concept ‘Concept<model>()’ was not satisfied

$ g++ -c -std=c++1z t.cpp -DWORKAROUND
<no error>

Reply via email to