public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95657] New: Bogus error message in "auto" with -std=c++11
@ 2020-06-12 14:42 haoxintu at gmail dot com
  2020-06-15 10:00 ` [Bug c++/95657] Duplicate error messages for decltype(auto) " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-12 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95657
           Summary: Bogus error message in "auto" with -std=c++11
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code bug.cc

decltype (auto) foo( decltype (auto) a ){   }

in GCC-trunk

$g++ -c -std=c++11 bug.cc
bug.cc:1:11: error: expected primary-expression before ‘auto’
    1 | decltype (auto) foo( decltype  (auto) a ){   }
      |           ^~~~
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
    1 | decltype (auto) foo( decltype  (auto) a ){   }
      |                                 ^~~~
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
bug.cc:1:33: error: use of ‘auto’ in parameter declaration only available with
‘-std=c++14’ or ‘-std=gnu++14’
bug.cc:1:33: error: expected primary-expression before ‘auto’
bug.cc:1:22: error: expected primary-expression before ‘decltype’
    1 | decltype (auto) foo( decltype  (auto) a ){   }
      |                      ^~~~~~~~~~~~~~~~

I am sure there were some duplicate error messages about "error: use of ‘auto’
in parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’".

While in clang

$clang++ -c -std=c++11 bug.cc
bug.cc:1:11: warning: 'decltype(auto)' type specifier is a C++14 extension
[-Wc++14-extensions]
decltype (auto) foo( decltype  (auto) a ){   }
          ^
bug.cc:1:33: warning: 'decltype(auto)' type specifier is a C++14 extension
[-Wc++14-extensions]
decltype (auto) foo( decltype  (auto) a ){   }
                                ^
bug.cc:1:22: error: 'decltype(auto)' not allowed in function prototype
decltype (auto) foo( decltype  (auto) a ){   }
                     ^~~~~~~~
bug.cc:1:1: error: deduced return types are a C++14 extension
decltype (auto) foo( decltype  (auto) a ){   }
^
2 warnings and 2 errors generated.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-08 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 14:42 [Bug c++/95657] New: Bogus error message in "auto" with -std=c++11 haoxintu at gmail dot com
2020-06-15 10:00 ` [Bug c++/95657] Duplicate error messages for decltype(auto) " redi at gcc dot gnu.org
2021-09-07 17:12 ` pinskia at gcc dot gnu.org
2021-12-08 14:38 ` marxin at gcc dot gnu.org
2021-12-08 16:17 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).