Skip to content

test: add a test for ll suffixed types being promoted to ULL #23709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/ClangImporter/long-long-promotion.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s

import macros

func verifyIsSigned(_: Int64) { }
func verifyIsUnsigned(_: UInt64) { }

// Windows will not convert a long long value that overflows into an unsigned
// long long if it has the `ll` suffix of `i64` suffix. Ensure that the type is
// imported appropriately.
#if os(Windows)
verifyIsSigned(LL_TO_ULL)
#else
verifyIsUnsigned(LL_TO_ULL)
#endif

2 changes: 2 additions & 0 deletions test/Inputs/clang-importer-sdk/usr/include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#define TRUE 1
#define FALSE 0

#define LL_TO_ULL 0x8000000000000000LL

#define A_PI M_PI

#define VERSION_STRING "Swift 1.0"
Expand Down