[LLVMbugs] [Bug 21036] New: If a keyword reverts to an identifier, things don't get serialized right to a PCH file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 22 19:43:25 PDT 2014


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

            Bug ID: 21036
           Summary: If a keyword reverts to an identifier, things don't
                    get serialized right to a PCH file
           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

Created attachment 13067
  --> http://llvm.org/bugs/attachment.cgi?id=13067&action=edit
failing test

Consider:

Nicos-MacBook-Pro:Release thakis$ cat test.h
namespace foo {
template <typename _Tp>
struct __is_pod {
  enum {
    __value = 1
  };
};
}
Nicos-MacBook-Pro:Release thakis$ cat test.cc
template <typename T>
struct my_is_pod {
  static const bool value = __is_pod(T);
};

int f() {
  return my_is_pod<int>::value;
}
Nicos-MacBook-Pro:Release thakis$ clang -x c++-header test.h -o test.h.gch
-stdlib=libstdc++
Nicos-MacBook-Pro:Release thakis$ clang -include test.h -c test.cc
-stdlib=libstdc++
test.cc:3:38: error: 'T' does not refer to a value
  static const bool value = __is_pod(T);
                                     ^
test.cc:1:20: note: declared here
template <typename T>
                   ^
1 error generated.


But this passes:

Nicos-MacBook-Pro:Release thakis$ rm test.h.gch 
Nicos-MacBook-Pro:Release thakis$ clang -c test.cc -std=c++11 -include test.h
In file included from <built-in>:188:
In file included from <command line>:1:
test.h:3:8: warning: keyword '__is_pod' will be made available as an identifier
for the remainder of the translation unit [-Wkeyword-compat]
struct __is_pod {
       ^
1 warning generated.


r110868 looks like it fixed this in the other direction, and
test/PCH/cxx-traits.cpp tests that other direction. The attached patch adds a
test (but not a fix) for the still-buggy direction described above.

-- 
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/20140923/e9c534fb/attachment.html>


More information about the llvm-bugs mailing list