[Bug c++/85808] New: [concepts] unqualified name lookup breaks after qualified lookup in nested requirement

Casey at Carter dot net gcc-bugzilla@gcc.gnu.org
Wed May 16 14:01:00 GMT 2018


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

            Bug ID: 85808
           Summary: [concepts] unqualified name lookup breaks after
                    qualified lookup in nested requirement
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

Compiling this program fragment with "g++ -std=c++17 -fconcepts"
(https://godbolt.org/g/EXDoD3):

  namespace X {
      template<class> constexpr bool x = true;
  }

  template<int> using helper = void;

  template<typename T>
  concept bool C = requires {
      requires X::x<T>;
  #ifndef WORKAROUND
      typename helper<T{}>;
  #else
      typename ::helper<T{}>; // Workaround
  #endif
  };

  static_assert(C<int>);

produces diagnostics:

  <source>:11:14: error: 'X::helper' has not been declared
       typename helper<T{}>;
                ^~~~~~
  <source>:11:24: error: expected ';' before '>' token
       typename helper<T{}>;
                          ^
                          ;
  <source>:11:24: error: expected '}' before '>' token
  <source>:8:27: note: to match this '{'
   concept bool C = requires {
                             ^
  <source>:11:25: error: expected primary-expression before ';' token
       typename helper<T{}>;
                           ^
  <source>:15:1: error: expected declaration before '}' token
   };
   ^

rather than the expected successful and silent compile.


More information about the Gcc-bugs mailing list