Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:27:58+00:00 2026-06-14T11:27:58+00:00

Clang has the following test cases: #if 0 #ifdef D #else 1 // Should

  • 0

Clang has the following test cases:

#if 0
#ifdef D
#else 1       // Should not warn due to C99 6.10p4
#endif
#endif

#if 0
#else 1   // expected-warning {{extra tokens}}
#endif

The first #else 1 indeed is fine because it’s in a skipped group, but as far as I can see the second one should be an error – it doesn’t match what the standard specifies as the syntax for preprocessor directives – yet GCC and Microsoft C++ agree on only giving it a warning. What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:27:59+00:00Added an answer on June 14, 2026 at 11:27 am

    The standard does not have notions of “error” and “warning”, it only knows “diagnostic”. It is up to implementation to define what constitutes a diagnostic. Most implementations of C, including clang and gcc, define diagnostics to include both errors and warnings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following range-based-for snippet compiles fine in g++ 4.6.1, but not with clang++ version
The following code compiles with GCC 4.7 and clang 3.0, but not with MSVC
Clang has a very cool extension named block bringing true lambda function mechanism to
It's clear that Apple has an OpenCL implementation based on Clang and LLVM. There's
LLVM 2.6 + clang. Trying to compile C++ file and got: clang: warning: not
A template function I have written has the following signature: template<class IteratorT> auto average(IteratorT&
Has anybody run Clang as a C compiler on ppc architecture? I am trying
This compiles when using clang -std=gnu++11 -c test.cpp : void test() { [[random text
My project has top-level directory proj with subdirectories runtime and test . Basically, test
I've got the following code that someone working on MSVC has given to me:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.