From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 1713E3858C50 for ; Thu, 9 Feb 2023 14:27:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1713E3858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x630.google.com with SMTP id jg8so6854478ejc.6 for ; Thu, 09 Feb 2023 06:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cu3JD5aZ+ofR7wMTBRmMckZTKb/UYIirWvCdxYKX4JU=; b=ZTagdh7AUWyo/i1Y++tbcE9baxj8WphxRu+Jibo08uh0GpMGk/odajoKUKnEWs8rW8 IzeH46Ip0fV2DbU8PAjHsfcBf2wUWolzdY7M6cgoSBs9gOoYzw+wolk+vRwRR/P7sM4t 5+hS8xHSLTqsCVvBVW6yBEjTLbEmUTR07V4qhmQ1OgGHZ3tbqy9MkiCJDLUUKvN8Dynf UapZMm+azNcY7nL1H7sjSgPPKli9TYLuJGG1U9qVkdsLgJ6UGpDF7T5qNxb520pZYBly gP2t6k6MocGEWxg6zM1B0eyeXQjQyLljtTMyscTLDgqD3AYQ7wXFlXHI+NN4uNCBu49y +bDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cu3JD5aZ+ofR7wMTBRmMckZTKb/UYIirWvCdxYKX4JU=; b=jfYjov5aogNspmxHGz7NOjZYRaLGWxAd2uwfm535CU/1LyHmJhA6wW41BwvNY5Hxi0 qDLbX0Zoh5ipRb9BeVm0KJvLkuT/EWn67joH1iC3Lvz2ksWZdsMVHmaFpV5VWYg1sYaT 5arHAxTH97tU1UXuC+eWtAa+XrDB032nvR8bgx62HVJE086zhzy6HxPM1qkPSr1/Ddmt bs8xzJuVol+Iv2V+FyhhSHnCv47owxyCsK7V578j6q3WNx5b+jBuCceUurmPl85Qcovw 5hf6eWWawsgQWZhTtii+rLkNzvSqeatAI0uJMsH2THCMJtX7wBAfoKzppsf4NElVh8ON K23Q== X-Gm-Message-State: AO0yUKVnzUt5rGkqnWlHMKYEabr3FNwtxPwUeHVLCDzRnIpvtzZoLArk tFxuyytd4hXnVMfxUxC0IWoa4M+Z8CEhOBvN4JM= X-Google-Smtp-Source: AK7set+iOAoyS7ffzzfCj8etQe/mqcNdIRWTn7O1tBxLMCTWw8JUVJ8mRV4LQmJLWcPToIZwvqIsl1SaJz1KDlb51Mg= X-Received: by 2002:a17:907:2c48:b0:877:747d:1112 with SMTP id hf8-20020a1709072c4800b00877747d1112mr556708ejc.15.1675952849550; Thu, 09 Feb 2023 06:27:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 9 Feb 2023 14:27:18 +0000 Message-ID: Subject: Re: Compiler error when using typedef void as function parameter with gcc 4.4.2 To: "Singh, Mithun" Cc: "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 9 Feb 2023 at 14:08, Singh, Mithun via Gcc-help wrote: > > Hello, > > I have typedef void as follows in one of my header files: > > typedef void VOID; > > And I am using this typedef as function parameter as follows: > > VOID someFunction(VOID); Why would you want to do that? It's just silly. > This code compiles fine with gcc 3.3.5, but when I compile it with gcc 4.4.2, I get following error: Why are you using such ancient versions? It's not 2009. > > error: '' has incomplete type > error: invalid use of 'VOID' > > Will you please shed some light on why would it not work with gcc 4.4.2? Because the C++ standard says it's not valid, and GCC got fixed to follow the standard. A function with no parameters can only be declared with () or (void), not with a typedef to void. The tokens "(void)" have special meaning for compatibility with C, but (VOID) is nonsense. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=9278