[LLVMbugs] [Bug 23245] New: [ms] clang-cl doesn't reject a selectany program that cl rejects

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 15 15:59:38 PDT 2015


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

            Bug ID: 23245
           Summary: [ms] clang-cl doesn't reject a selectany program that
                    cl rejects
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This is rejected by cl but not by clang-cl:

template<typename T> struct C {
  __declspec(selectany) static int a;
};
int f() {
  C<int> c;
  return c.a;
}


D:\src\llvm-ninja-rel64>cl foo.cc
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

foo.cc
foo.cc(7) : error C2496: 'C<T>::a' : 'selectany' can only be applied to data
items with external linkage
        foo.cc(8) : see reference to class template instantiation 'C<T>' being
compiled
foo.cc(7) : error C2496: 'C<int>::a' : 'selectany' can only be applied to data
items with external linkage
        foo.cc(10) : see reference to class template instantiation 'C<int>'
being compiled

We should reject it too.

-- 
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/20150415/87ddb2e4/attachment.html>


More information about the llvm-bugs mailing list