[llvm-bugs] [Bug 25367] New: Should clang warn about partial specialization after instantiation?

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 31 15:11:33 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25367

            Bug ID: 25367
           Summary: Should clang warn about partial specialization after
                    instantiation?
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: yaron.keren at gmail.com
                CC: llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
    Classification: Unclassified

In the code below, T2<int,int> will not have mytype member, as T2<int,int> is
first instantiated in line 2 and then T2<T,int> specialized in line 3.

1 template <typename T, typename> struct T2 {};
2 template struct T2<int, int>;
3 template <typename T> struct T2<T, int> { typedef int mytype; };
4 void foo() { T2<int,int>::mytype i; }

If we swap lines 2 and 3, T2<int,int> will have mytype as T2<int,int> will find
and use the specialization T2<T,int>.

Similar to error: explicit specialization after instantiation, should we error
or warn about this, a specialization that would have changed existing
instantiation if it would have come before it?

-- 
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/20151031/a9aa560a/attachment.html>


More information about the llvm-bugs mailing list