[LLVMbugs] [Bug 12709] New: In microsoft mode, be more forgiving about explicit specialization in class scope to make <bitset> work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 30 16:47:01 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12709

             Bug #: 12709
           Summary: In microsoft mode, be more forgiving about explicit
                    specialization in class scope to make <bitset> work
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


C:\src\chrome\src>type testbitset.cc
template<unsigned NBits>
class bitset {
  void trim() {
    ttrim<NBits % 32 != 0>();
  }

  template<bool b>
  void ttrim() {}

  template<>
  void ttrim<false>() {}
};

int main() {
  bitset<15> bs;
}

C:\src\chrome\src>cl /c testbitset.cc
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

testbitset.cc

C:\src\chrome\src>..\..\llvm-build\bin\Release\clang.exe -c testbitset.cc
testbitset.cc:11:8: warning: explicit specialization of 'ttrim' within class
scope is a Microsoft extension
      [-Wmicrosoft]
  void ttrim<false>() {}
       ^
testbitset.cc:11:8: error: no function template matches function template
specialization 'ttrim'
testbitset.cc:15:14: note: in instantiation of template class 'bitset<15>'
requested here
  bitset<15> bs;
             ^
1 warning and 1 error generated.


This is needed to make msvc's <bitset> work. The warning suggests that clang is
already trying to do the right thing in ms mode, but the second change needs to
become a warning too somehow.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list