[llvm-bugs] [Bug 24892] New: invalid error on 'virtual' inside extern C

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 21 06:10:28 PDT 2015


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

            Bug ID: 24892
           Summary: invalid error on 'virtual' inside extern C
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: christoph.gysin at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following header virtual.h:

#ifdef __cplusplus
extern "C" {
#endif

struct s {
    struct {
        int i;
    } virtual;
};

#ifdef __cplusplus
}
#endif

included from a C++ source main.cc:

#include "virtual.h"

causes:

$ clang++ -c main.cc
In file included from main.cc:1:
./virtual.h:8:7: error: 'virtual' can only appear on non-static member
functions
    } virtual;
      ^
1 error generated.

g++ happily compiles the same source:

$ g++ -c main.cc

-- 
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/20150921/a63b93e6/attachment-0001.html>


More information about the llvm-bugs mailing list