[llvm-bugs] [Bug 38127] New: explicit specialization in non-namespace scope

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 10 17:54:04 PDT 2018


            Bug ID: 38127
           Summary: explicit specialization in non-namespace scope
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follows:

struct Type {
 template <int i>
 static void Foo() {}
 template <>
 void Foo<0>() {}

void call() { Type::Foo<0>(); }

clang++ accepts the code, but g++ rejects it:

code0.cpp:4:12: error: explicit specialization in non-namespace scope 'struct
  template <>
code0.cpp:5:14: error: template-id 'Foo<0>' in declaration of primary template
  void Foo<0>() {}

The diagnose of g++ looks reasonable, right?

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180711/3028c58f/attachment.html>

More information about the llvm-bugs mailing list