public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60753] New: defining an explicit function template specialization as deleted, following a non-deleted declaration, not diagnosted
@ 2014-04-03 23:22 filip.roseen at gmail dot com
  2014-11-26 17:13 ` [Bug c++/60753] Deleted definition of an explicit function template specialization, following a declaration, incorrectly accepted paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: filip.roseen at gmail dot com @ 2014-04-03 23:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60753

            Bug ID: 60753
           Summary: defining an explicit function template specialization
                    as deleted, following a non-deleted declaration, not
                    diagnosted
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

Created attachment 32537
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32537&action=edit
testcase.cpp

template<class T> void func (T);

template<> void func<int> (int);
template<> void func<int> (int) = delete;

int main () { }

------------------------------------------------------------------------

`gcc` accepts the above snippet.

------------------------------------------------------------------------

The previous snippet is ill-formed according to [dcl.fct.def.delete]p4:

  > A deleted definition of a function shall be the first declaration
  > of the function or, for an explicit specialization of a function
  > template, the first declaration of that specialization.

------------------------------------------------------------------------

`clang` correctly issues the following diagnostic:

testcase.cpp:4:35: error: deleted definition must be first declaration
template<> void func<int> (int) = delete;
                                  ^
testcase.cpp:3:17: note: previous declaration is here
template<> void func<int> (int);
                ^

------------------------------------------------------------------------


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

end of thread, other threads:[~2015-01-08 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 23:22 [Bug c++/60753] New: defining an explicit function template specialization as deleted, following a non-deleted declaration, not diagnosted filip.roseen at gmail dot com
2014-11-26 17:13 ` [Bug c++/60753] Deleted definition of an explicit function template specialization, following a declaration, incorrectly accepted paolo.carlini at oracle dot com
2015-01-07 19:48 ` paolo.carlini at oracle dot com
2015-01-08 15:49 ` paolo at gcc dot gnu.org
2015-01-08 16:10 ` paolo.carlini at oracle dot com

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).