Bug 96219 - New Feature (c++ core 727): explicit specialization in class definition should be allowed
Summary: New Feature (c++ core 727): explicit specialization in class definition shoul...
Status: RESOLVED DUPLICATE of bug 85282
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2020-07-16 13:53 UTC by Haoxin Tu
Modified: 2020-07-16 13:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Haoxin Tu 2020-07-16 13:53:52 UTC
Hi,all.

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#727

According to above link, explicit specialization in class definition should be allowed.

For example,

$cat test.cc
class A {
    template <class> void F(){};
    template <> void F<int>(); 
};


$g++ -std=c++17 test.cc
test.cc:3:15: error: explicit specialization in non-namespace scope 'class A'
    3 |     template <> void F<int>();
      |               ^
test.cc:3:22: error: template-id 'F<int>' in declaration of primary template
    3 |     template <> void F<int>();
      |                      ^~~~~~

I report this because of the related discussion in llvm:
https://bugs.llvm.org/show_bug.cgi?id=46728

Thanks,
Haoxin
Comment 1 Marek Polacek 2020-07-16 13:59:43 UTC
Dup.

*** This bug has been marked as a duplicate of bug 85282 ***