This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85706] New: [8 regression][concepts] Bogus "deduced class type in function return type"


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

            Bug ID: 85706
           Summary: [8 regression][concepts] Bogus "deduced class type in
                    function return type"
           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:

  template<class T> struct S {
      S(T);
  };

  template<class = void>
  auto f() -> decltype(S(42)); // error

with "-std=c++17 -fconcepts" produces diagnostics:

  /home/casey/casey/Desktop/repro.cpp:6:6: error: deduced class type ‘S’ in
function return type
   auto f() -> decltype(S(42)); // Line 6
        ^
  /home/casey/casey/Desktop/repro.cpp:1:26: note: ‘template<class T> struct S’ 
  declared here
   template<class T> struct S {
                            ^

the program compiles without diagnostic if f is a non-template:

  template<class T> struct S {
      S(T);
  };

  auto f() -> decltype(S(42));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]