[Bug c++/68683] New: [concepts] function satisfy_argument_deduction_constraint modifies a type tree node but leaves TYPE_CANONICAL unchanged

ryan.burn at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 3 18:02:00 GMT 2015


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

            Bug ID: 68683
           Summary: [concepts] function
                    satisfy_argument_deduction_constraint modifies a type
                    tree node but leaves TYPE_CANONICAL unchanged
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes a "same canonical type node for different types" ICE
because the function satisfy_argument_deduction_constraint changes the
PLACEHOLDER_TYPE_CONSTRAINTS for a tree node but leaves the TYPE_CANONICAL
value unchanged. Since PLACEHOLDER_TYPE_CONSTRAINTS are used when checking for
equality, \ the TYPE_CANONICAL value is no longer valid for the changed type
which triggers the ICE.

///////////////////////////////////////////////////////////////////
template <typename, typename>                                                   
struct is_same  {                                                               
  static constexpr bool value = true;                                           
};                                                                              

template <typename T, typename U>                                               
concept bool Same = is_same<T, U>::value;                                       

template <typename T>                                                           
concept bool Integral = requires{                                               
  { T() } -> Same<typename T::value_type>;                                      
};                                                                              

struct A {                                                                      
  using value_type = bool;                                                      
};                                                                              

int main() {                                                                    
  Integral<A>;                                                                  
  Integral<A>;                                                                  
  return 0;                                                                     
}
///////////////////////////////////////////////////////////////////


More information about the Gcc-bugs mailing list