mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 540909 - underlying_type of typedef to enum
Change-Id: Ic4f48c4da79419d5404e132da2944ee2823ca41f
This commit is contained in:
parent
ef2b34f148
commit
b6c1a085d1
2 changed files with 21 additions and 1 deletions
|
@ -11346,6 +11346,23 @@ public class AST2CPPTests extends AST2CPPTestBase {
|
|||
assertSameType((ITypedef) helper.assertNonProblem("loong_type"), CPPBasicType.LONG);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct underlying_type {
|
||||
// typedef __underlying_type(T) type;
|
||||
// };
|
||||
//
|
||||
// enum class FooBar { Foo, Bar };
|
||||
// using Alias = FooBar;
|
||||
//
|
||||
// void bar(underlying_type<Alias>::type);
|
||||
//
|
||||
// void test() {
|
||||
// bar(2);
|
||||
// }
|
||||
public void testUnderlyingType_540909() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP, true /* use GNU extensions */);
|
||||
}
|
||||
|
||||
// void ptrFunc(void*);
|
||||
// void intFunc(int);
|
||||
// void foo(int* pi, unsigned i) {
|
||||
|
|
|
@ -475,7 +475,10 @@ public class TypeTraits {
|
|||
public static IType underlyingType(IType type) {
|
||||
if (CPPTemplates.isDependentType(type)) {
|
||||
return new CPPUnaryTypeTransformation(Operator.underlying_type, type);
|
||||
} else if (!(type instanceof ICPPEnumeration)) {
|
||||
}
|
||||
|
||||
type = SemanticUtil.getSimplifiedType(type);
|
||||
if (!(type instanceof ICPPEnumeration)) {
|
||||
return ProblemType.ENUMERATION_EXPECTED;
|
||||
} else {
|
||||
ICPPEnumeration enumeration = (ICPPEnumeration) type;
|
||||
|
|
Loading…
Add table
Reference in a new issue